Skip to content

Buzzingz

Unleashing the Power of Code

  • HTML
  • CSS
  • Toggle search form

CSS Tables

Posted on March 12, 2023March 12, 2023 By shani No Comments on CSS Tables

CSS can be used to style tables in HTML. Here are some common CSS styles for tables:

  1. Set border: By default, tables have no border. You can add a border to the table using the border property in CSS. For example:
table {
  border: 1px solid black;
}

This will add a black border with a width of 1 pixel to the table.

2. Set table width: You can set the width of the table using the width property in CSS. For example:

table {
  width: 100%;
}

This will make the table take up 100% of the available width on the webpage.

3. Set table cell padding: You can set the padding of the cells in the table using the padding property in CSS. For example:

td, th {
  padding: 10px;
}

This will add 10 pixels of padding to all cells in the table.

4. Set table cell border: You can set a border for cells in the table using the border property in CSS. For example:

td, th {
  border: 1px solid black;
}

This will add a black border with a width of 1 pixel to all cells in the table.

5. Set table cell background color: You can set the background color of cells in the table using the background-color property in CSS. For example:

td {
  background-color: #f2f2f2;
}

This will set the background color of all cells in the table to a light gray color.

These are just a few examples of how you can style tables using CSS. Remember to experiment with different styles and find what works best for your website.

CSS

Post navigation

Previous Post: CSS Lists
Next Post: CSS Layout – The display Property

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CSS Tutorial

  • Basic CSS Tutorial For Beginners
  • CSS Introduction
  • CSS Syntax
  • CSS Selectors
  • How To Add CSS
  • CSS Comments
  • CSS Colors
  • CSS Backgrounds
  • CSS Borders
  • CSS Margins
  • CSS Margin Collapse
  • CSS Padding
  • CSS Height, Width and Max-width
  • CSS Box Model
  • CSS Outline
  • CSS Text
  • CSS Fonts
  • CSS Web Safe Fonts
  • CSS Font Fallbacks
  • CSS Font Style
  • CSS Font Size
  • CSS Google Fonts
  • CSS Great Font Pairings
  • CSS Icons
  • CSS Links
  • CSS Lists
  • CSS Tables
  • CSS Layout – display: inline-block
  • CSS Layout – float and clear
  • CSS Layout – Horizontal & Vertical Align
  • CSS Layout – Overflow
  • CSS Layout – The display Property
  • CSS Layout – The z-index Property
  • CSS Layout – width and max-width
  • CSS Layout – The position Property
  • CSS Attribute Selectors
  • CSS Image Sprites
  • CSS Image Gallery
  • CSS Dropdowns
  • CSS Horizontal Navigation Bar
  • CSS Vertical Navigation Bar
  • CSS Navigation Bar
  • CSS Opacity / Transparency
  • CSS Pseudo-elements
  • CSS Pseudo-classes
  • CSS Combinators
  • CSS Math Functions
  • CSS The !important Rule
  • CSS Specificity
  • CSS Units
  • CSS Website Layout
  • CSS Counters
  • CSS Forms
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions

Copyright © 2023 Buzzingz.

Powered by PressBook WordPress theme