{"id":3220,"date":"2015-04-09T12:15:47","date_gmt":"2015-04-09T09:15:47","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=3220"},"modified":"2018-01-09T09:16:52","modified_gmt":"2018-01-09T07:16:52","slug":"css-table-design-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/","title":{"rendered":"CSS Table Design Example"},"content":{"rendered":"<p>The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples.<\/p>\n<p>Since web pages are loaded with a lot of information, it sometimes becomes a neccesity organising data in a more easy-to-read and intuitive way.<\/p>\n<p>That is where CSS can be of great help. Below you can find a complete guide to CSS Tables, from the html setup to the stylish viewpoint of table rows and cells.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;nAkUl5IbAjqlXSla&#8217;]<\/p>\n<h2>1. The Initial Layout<\/h2>\n<p>First, go on and create a <code>html<\/code> file. This file is going to be the one we are putting both HTML and CSS code so as to keep it as simple as possible. However, when considering more complicated webpages with a lot of HTML, I recommend you separate the styling code in a <code>css<\/code> file.<\/p>\n<h3>1.1 Setting up the HTML<\/h3>\n<p>The initial layout consists of creating the basic structure of html we need.<\/p>\n<p>To do this, let&#8217;s first explain what kind of tags do we have for tables in html and what do they mean:<\/p>\n<p>1. <code>table<\/code> &#8211; this tag defines a <strong>table<\/strong> in html.<br \/>\n2. <code>tr<\/code> &#8211; this tag divides the table into <strong>table rows<\/strong>.<br \/>\n3. <code>td<\/code> &#8211; this tags creates the cell, it means <strong>table data<\/strong>.<br \/>\n4. <code>th<\/code> &#8211; this tag creates a <strong>table heading<\/strong>.<\/p>\n<p>With this said, let&#8217;s create the basic table structure in html with randomly 3 rows and 3 columns, like below:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;CSS Tables Example&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;&lt;\/th&gt;\r\n    &lt;th&gt;&lt;\/th&gt; \r\n    &lt;th&gt;&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;&lt;\/td&gt;\r\n    &lt;td&gt;&lt;\/td&gt; \r\n    &lt;td&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;&lt;\/td&gt;\r\n    &lt;td&gt;&lt;\/td&gt; \r\n    &lt;td&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>As you can see, we created the <code>table<\/code> tag inside the <code>body<\/code> tag. After this, we added first the rows tag <code>tr<\/code> and inside each row the table data (or cells) with the <code>td<\/code> tag. Notice we also added a table heading row using the <code>th<\/code> tag, in the first row.<\/p>\n<p>By default, you should not see anything shown in the browser until now, and that is because we only created the table, but did not put there any data or styling, so both information and layout are missing. We&#8217;ll add them soon.<\/p>\n<h3>1.2 Understanding the Style Basics<\/h3>\n<p>Our table needs to be filled, so let&#8217;s give it some random information in this example. To give it styling and layout attributes<br \/>\nwe create a <code>style<\/code> tag where all the css code is going to be put. To begin, I am giving this <code>table<\/code> two attributes:<\/p>\n<p>1. <code>width<\/code> attribute of 40% (a normal width for having a pleasant view of the table, we will add custom width later)<br \/>\n2. <code>border<\/code> attribute of <code>0.1em\u00a0solid<\/code> to the <code>table<\/code>, <code>th<\/code> and <code>td<\/code> tags.<\/p>\n<p>The code now looks like this:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\r\n\twidth: 40%;\r\n\tborder: 0.1em solid;\t}\r\n\r\n\ttd {\t\r\n\tborder: 0.1em solid;\t}\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;\t}\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n\t&lt;table &gt;\r\n\t&lt;tr&gt;\r\n    &lt;th&gt;Name&lt;\/th&gt;\r\n    &lt;th&gt;Surname&lt;\/th&gt; \r\n    &lt;th&gt;Age&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Fabio&lt;\/td&gt;\r\n    &lt;td&gt;Cimo&lt;\/td&gt; \r\n    &lt;td&gt;20&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Jasmin&lt;\/td&gt;\r\n    &lt;td&gt;Brown&lt;\/td&gt; \r\n    &lt;td&gt;18&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n<\/pre>\n<p>And this is what the table in the browser looks like:<\/p>\n<figure id=\"attachment_3248\" aria-describedby=\"caption-attachment-3248\" style=\"width: 770px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3248\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table1.jpg\" alt=\"First Look of the Table View with inital attributes applied.\" width=\"770\" height=\"178\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table1.jpg 770w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table1-300x69.jpg 300w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/a><figcaption id=\"caption-attachment-3248\" class=\"wp-caption-text\">First Look of the Table View with inital attributes applied.<\/figcaption><\/figure>\n<p>Notice that the table headings are set in a <strong>bold<\/strong> style and <strong>centered<\/strong> position by default by the browser.<\/p>\n<p>So remember that whatever you put inside the <code>th<\/code> tag is styled this way everytime, but you can change it.<\/p>\n<p>Other table data, like the cell information is just normal text and aligned left by default.<\/p>\n<p>You probaby see that every cell has its own surrounding\/separate border and that looks just bad.<\/p>\n<p>We fix that with the <code>border-collapse:collapse<\/code> attribute given to the <code>table<\/code>.<\/p>\n<p>(We are later in this article going to have a closer look to the <code>border-collapse<\/code> property)<\/p>\n<p>That eleminates the need for <code>border<\/code> attributes inside the <code>table<\/code> tag.<\/p>\n<p>Lets also align all the table data (<code>td<\/code> tag) in the <code>center<\/code>.<\/p>\n<p>Now we have a code that looks like this in the style section:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\r\n\twidth: 40%;                        \/* the 'border' attribute is removed here *\/\r\n\tborder-collapse:collapse }\r\n\r\n\ttd {\t\r\n\tborder: 0.1em solid;\r\n\ttext-align: center;\t}\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;\r\n\ttext-align: center;\t}\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>The result in the browser would be:<\/p>\n<figure id=\"attachment_3266\" aria-describedby=\"caption-attachment-3266\" style=\"width: 771px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3266\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table2.jpg\" alt=\"Table View with 'text-align' and 'border-collapse' attributes applied.\" width=\"771\" height=\"174\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table2.jpg 771w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table2-300x68.jpg 300w\" sizes=\"(max-width: 771px) 100vw, 771px\" \/><\/a><figcaption id=\"caption-attachment-3266\" class=\"wp-caption-text\">Table View with &#8216;text-align&#8217; and &#8216;border-collapse&#8217; attributes applied.<\/figcaption><\/figure>\n<p>Now we can say we have created a simple table that looks fine. But there are lots of other styles we can apply to make this table look a lot more interesting and attractive.<\/p>\n<h2>2. Modifying Table Elements Styles<\/h2>\n<p>Up until now, we used a <code>40% width<\/code> attribute for our table.<\/p>\n<p>Now we will see a more specific way for adjusting the width of the table, defined by the width of every cell.<\/p>\n<h3>2.1 Spacing<\/h3>\n<p>There are several spacing considerations when talking about table\/row\/cell sizes. Two of them are most popular and shown below.<\/p>\n<p>1. Set the size of of your table according to the desired <code>width<\/code> of the <strong>cells<\/strong> and <code>height<\/code> of the <strong>rows<\/strong> like this:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\r\n\t                               \/* the 'width: 40%' attribute is removed here *\/\r\n\tborder-collapse:collapse }\r\n\r\n\ttd {\t\r\n\tborder: 0.1em solid;           \/* cells have their 'border' attribute *\/\r\n\ttext-align: center;\r\n\twidth: 10em;\t}             \/* added cell width *\/\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;         \/* cells have their 'border' attribute *\/\r\n\ttext-align: center;\r\n\twidth: 10em;\t}            \/* added cell width *\/\r\n\r\n\ttr {\t\r\n\theight: 2em;\t}           \/* added row height *\/\r\n\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>This would make the <strong>cells 10em wide<\/strong> and <strong>rows 2em high<\/strong>. And we&#8217;d get this view:<\/p>\n<figure id=\"attachment_3278\" aria-describedby=\"caption-attachment-3278\" style=\"width: 502px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3278\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table3.jpg\" alt=\"Table Width and Spacing using Cells Width and Rows Height\" width=\"502\" height=\"201\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table3.jpg 502w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table3-300x120.jpg 300w\" sizes=\"(max-width: 502px) 100vw, 502px\" \/><\/a><figcaption id=\"caption-attachment-3278\" class=\"wp-caption-text\">Table Width and Spacing using Cells Width and Rows Height<\/figcaption><\/figure>\n<p>2. Set an inner space called <code>padding<\/code> to the cells (and\/or headings of the table) by adding this attribute to the style like this:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\r\n\tborder: 0.1em solid;\r\n\tborder-collapse:collapse }\r\n\r\n\ttd {\t\r\n\tborder: 0.1em solid;\r\n\ttext-align: center;\r\n\twidth: 10em;\r\n\tpadding: 1em;\t}\t\t\t\t\/* added cell padding to the table data cells *\/\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;\r\n\ttext-align: center;\r\n\twidth: 10em;\r\n\tpadding: 2em;\t}\t\t\t\t\/* added cell padding to the heading cells *\/\r\n\r\n\ttr {\t\r\n\theight: 2em;\t}\r\n\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>In this case, I added a <strong>2em<\/strong> <code>padding<\/code> to the <em>heading cells<\/em> and <strong>1em<\/strong> to the <em>data cells<\/em>.<\/p>\n<figure id=\"attachment_3282\" aria-describedby=\"caption-attachment-3282\" style=\"width: 689px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3282\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table4.jpg\" alt=\"Cell Spacing using the Padding attribute\" width=\"689\" height=\"328\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table4.jpg 689w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table4-300x143.jpg 300w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><\/a><figcaption id=\"caption-attachment-3282\" class=\"wp-caption-text\">Cell Spacing using the Padding attribute<\/figcaption><\/figure>\n<p><\/p>\n<h3>2.2 Border Styling<\/h3>\n<p>Until now, we have set a <code>1px solid<\/code> border style for our table. And that is just good.<\/p>\n<p>But lets see other options and customizations we can apply to the table border.<\/p>\n<p><code>dotted<\/code> &#8211; dotted border<br \/>\n<code>dashed<\/code> &#8211; dashed border<br \/>\n<code>solid<\/code> &#8211; solid border<br \/>\n<code>double<\/code> &#8211; double border<\/p>\n<p>The way we apply border styles is as in the code below:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\t\t\t\t\r\n\tborder: 0.1em dashed;             \/* added different border style: dashed *\/\r\n\tborder-collapse:collapse }\r\n\r\n\ttd {\t\r\n\tborder: 0.1em dashed;\t\t\t\t\/* added different border style: dashed *\/\r\n\ttext-align: center;\r\n\twidth: 5em;\r\n\tpadding: 0.5em;\t}\t\t\t\t\r\n\r\n\tth {\t\r\n\tborder: 0.1em dashed;\t\t\t\t\/* added different border style: dashed *\/\r\n\ttext-align: center;\r\n\twidth: 5em;\r\n\tpadding: 1em;\t}\t\t\t\t\r\n\r\n\ttr {\t\r\n\theight: 1em;\t}\r\n\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>For the sake of displaying these four styles in one picture, I have reduced the width and padding of the cells.<\/p>\n<figure id=\"attachment_3291\" aria-describedby=\"caption-attachment-3291\" style=\"width: 745px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table5.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3291\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table5.jpg\" alt=\"Fixed Border Styles\" width=\"745\" height=\"409\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table5.jpg 745w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table5-300x165.jpg 300w\" sizes=\"(max-width: 745px) 100vw, 745px\" \/><\/a><figcaption id=\"caption-attachment-3291\" class=\"wp-caption-text\">Fixed Border Styles<\/figcaption><\/figure>\n<p>We can also have combinations of these styles, using the following:<\/p>\n<p><code>dotted solid<\/code> which gives a top and bottom style of <code>dotted<\/code> and left and right of <code>solid<\/code><br \/>\n<code>dotted solid double dashed<\/code> which gives a specific style to each border.<\/p>\n<p>Additionally, borders can have different colors and border-widths than the default by applying:<\/p>\n<p>1. For the color, the <code>border-color<\/code> attribute or simply adding the color code into the <code>border<\/code> attribute.<br \/>\n2. For <code>border-width<\/code> the attribute with the same name or right from the <code>border<\/code> tag.<\/p>\n<p>All cases are shown below and commented:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\t\t\r\n\t\t\t\t\t\t\t\t\t \r\n\tborder-collapse: collapse;\t }\r\n\r\n\ttd {\t\r\n\tborder: solid #e74f3b;\t\t\t\t\/* added border color inside the border attribute *\/\r\n\ttext-align: center;     \r\n\twidth: 10em;\r\n\tborder-width: 0.2em;\t\t\t\t\/* added border width as a separate attribute *\/\r\n\tpadding: 1em; \t\t\t}\r\n\r\n\r\n\tth {\t\r\n\tborder: 0.2em solid;\t\t\t\t\/* added border width inside the border attribute *\/\r\n\ttext-align: center;\r\n\twidth: 10em;\r\n\tpadding: 1em;\r\n\tborder-color: #329bd7;\t\t}\t\t\/* added border color as a separate attribute *\/\r\n\t\t\t\r\n\r\n\ttr {\t\r\n\theight: 1em;\t}\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>This is what the table looks like after these two modifications on the css code:<\/p>\n<figure id=\"attachment_3299\" aria-describedby=\"caption-attachment-3299\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3299\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table6.jpg\" alt=\"Border Width and Border Color Applied\" width=\"596\" height=\"270\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table6.jpg 596w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table6-300x136.jpg 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/a><figcaption id=\"caption-attachment-3299\" class=\"wp-caption-text\">Border Width and Border Color Applied<\/figcaption><\/figure>\n<p><\/p>\n<h3>2.3 Cell Styling<\/h3>\n<p>Adding a few more lines into our <code>css<\/code> code will give our cell backgrounds a new look. Let&#8217;s remove some of the styling we did before like the <em>border-width<\/em> and <em>border-color<\/em> attributes to have a cleaner table.<\/p>\n<p>In the code below, I am giving the <strong>heading<\/strong> cells a light gray background and <strong>data<\/strong> cells a light green background:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\ttd {\t\r\n\tborder: 0.1em solid;\t\t\t\t\/* resetted to a default of 0.1em width *\/\t\t\r\n\ttext-align: center;     \r\n\twidth: 10em;\t\t\t\t\t\r\n\tpadding: 1em;\r\n\tbackground-color: #d8ffc4; \t\t}\t\/* added data cell background color (light green) *\/\r\n\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;\t\t\t\t\/* resetted to a default of 0.1em width *\/\r\n\ttext-align: center;\r\n\twidth: 10em;\r\n\tpadding: 1em;\r\n\tbackground-color: #ededed; \t\t}\t\/* added heading cell background color (light gray) *\/\r\n<\/pre>\n<p>Refreshing the browser, the result would be:<\/p>\n<figure id=\"attachment_3314\" aria-describedby=\"caption-attachment-3314\" style=\"width: 592px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3314\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table7.jpg\" alt=\"Table View after adding the 'background-color' attribute to the cells\" width=\"592\" height=\"260\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table7.jpg 592w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table7-300x132.jpg 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/><\/a><figcaption id=\"caption-attachment-3314\" class=\"wp-caption-text\">Table View after adding the &#8216;background-color&#8217; attribute to the cells<\/figcaption><\/figure>\n<p><\/p>\n<h2>3. Advanced Layout &amp; Style Customization<\/h2>\n<p>Even though we have covered a lot until now, there are still some interesting layout and styling changes that might be of great help to our specific cases. So we start with the layout changes we can use.<\/p>\n<h3>3.1 Layout Cases: Border-Collapse Property<\/h3>\n<p><code>border-collapse<\/code> &#8211; this property specifies whether the browser should control the appearance of adjacent borders that touch each other or whether each cell should maintain its style. It can have two possible values:<\/p>\n<p><code>border-collapse:collapse<\/code> and <code>border-collapse:separate<\/code><br \/>\nThe code below shows both cases: (duplicated our table code to have 2 tables in order to show both these two properties):<\/p>\n<p>CSS<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable.one {\t\t\t\t\t\t\t\t\t \r\n\tborder-collapse: collapse;\t\t\/* added border collapse:collapse to the first table *\/\r\n\tmargin-bottom: 5em;\t}\t\t\t\r\n\r\n\ttable.two {\t\t\t\t\t\t\t\t\t \r\n\tborder-collapse: separate;\t}\t\/* added border collapse:separate to the second table *\/\r\n\t\r\n\tcaption {\r\n\tpadding-bottom: 1em;\t}               \/* added caption padding to make it distinctive *\/\r\n\r\n\ttd {\t\r\n\tborder: 0.1em solid;\t\t\t\t\t\t\r\n\ttext-align: center;     \r\n\twidth: 10em;\t\t\t\t\t\r\n\tpadding: 1em; \t\t}\t\t\r\n\r\n\tth {\t\r\n\tborder: 0.1em solid;\t\t\t\t\r\n\ttext-align: center;\r\n\twidth: 10em;\r\n\tpadding: 1em;\t\t}\t\t\r\n\t\t\t\r\n\ttr {\t\r\n\theight: 1em;\t}\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>HTML<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;table class=&quot;one&quot;&gt;\r\n\t&lt;caption&gt;Collapse Border Example&lt;\/caption&gt;  &lt;!-- added table caption --&gt;\r\n\t&lt;tr&gt;\r\n    &lt;th&gt;Name&lt;\/th&gt;\r\n    &lt;th&gt;Surname&lt;\/th&gt; \r\n    &lt;th&gt;Age&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Fabio&lt;\/td&gt;\r\n    &lt;td&gt;Cimo&lt;\/td&gt; \r\n    &lt;td&gt;20&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Jasmin&lt;\/td&gt;\r\n    &lt;td&gt;Brown&lt;\/td&gt; \r\n    &lt;td&gt;18&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n\t&lt;table class=&quot;two&quot;&gt;\r\n\t&lt;caption&gt;Separate Border Example&lt;\/caption&gt;\t&lt;!-- added table caption --&gt;\r\n\t&lt;tr&gt;\r\n    &lt;th&gt;Name&lt;\/th&gt;\r\n    &lt;th&gt;Surname&lt;\/th&gt; \r\n    &lt;th&gt;Age&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Fabio&lt;\/td&gt;\r\n    &lt;td&gt;Cimo&lt;\/td&gt; \r\n    &lt;td&gt;20&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr&gt;\r\n    &lt;td&gt;Jasmin&lt;\/td&gt;\r\n    &lt;td&gt;Brown&lt;\/td&gt; \r\n    &lt;td&gt;18&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n<\/pre>\n<p>In this example I also added table captions just by adding the <code>caption<\/code> tag under the <code>table<\/code> tag.<\/p>\n<p>And referred to captions in css by giving the <code>caption<\/code> property attributes.<\/p>\n<p>You can also have captions in the <code>top<\/code>, <code>bottom<\/code>, <code>left<\/code> or <code>right<\/code> of the table according to your needs.<\/p>\n<p>You can achieve this by adding the <code>caption-side<\/code> attribute in your css code under the <code>caption<\/code> class.<\/p>\n<p>The view we are going to get is this:<\/p>\n<figure id=\"attachment_3343\" aria-describedby=\"caption-attachment-3343\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table8.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3343\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table8.jpg\" alt=\"Border-Collapse Property Cases\" width=\"596\" height=\"481\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table8.jpg 596w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table8-300x242.jpg 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/a><figcaption id=\"caption-attachment-3343\" class=\"wp-caption-text\">Border-Collapse Property Cases<\/figcaption><\/figure>\n<p><\/p>\n<h3>3.2 Layout Cases: Border-Spacing Property<\/h3>\n<p><code>border-spacing<\/code> &#8211; specifies the distance that separates adjacent cells, borders. It can take one or two values according to the spacing you need on different sides.<\/p>\n<p>The code below shows both cases:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\ttable.one {\t\t\t\t\t\t\t\t\t \r\n\tmargin-bottom: 5em;\t\r\n\tborder-collapse:separate;\t\t\r\n\tborder-spacing: 1em;  }\t\t\t\/* added the same top,bottom,right,left border spacing  *\/\r\n\r\n\ttable.two {\t\t\r\n\tborder-collapse:separate;\t\t\t\t\t\t\t \r\n\tborder-spacing: 0.5em 3em;\t}\t\/* added different top,bottom and right,left border spacing  *\/\r\n<\/pre>\n<p>In this case, we get the following view:<\/p>\n<p><figure id=\"attachment_3348\" aria-describedby=\"caption-attachment-3348\" style=\"width: 631px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table9.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3348\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table9.jpg\" alt=\"Border-Spacing Property\" width=\"631\" height=\"646\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table9.jpg 631w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table9-293x300.jpg 293w\" sizes=\"(max-width: 631px) 100vw, 631px\" \/><\/a><figcaption id=\"caption-attachment-3348\" class=\"wp-caption-text\">Border-Spacing Property<\/figcaption><\/figure><br \/>\n<\/p>\n<h3>3.3 Layout Cases: Empty-Cells Property<\/h3>\n<p><code>empty-cells<\/code> &#8211; used to indicate whether a cell without any content should have a border displayed.<br \/>\nIt can take 3 values:<\/p>\n<p><code>show<\/code> &#8211; given this attribute, all empty cells will show.<br \/>\n<code>hide<\/code> &#8211; given this attribute, all empty cells will hide.<br \/>\n<code>inherit<\/code> &#8211; given this attribute, all empty cells will by default show.<\/p>\n<p>All three cases are shown in the code below with the respective comments:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\ttable.one {\t\t\t\t\t\t\t\t\t \r\n\tmargin-bottom: 3em;\t\r\n\tborder-collapse:separate;\t\t\r\n\tempty-cells: inherit;  }\t\/* added empty-cells property: inherit *\/\r\n\r\n\ttable.two {\t\t\r\n\tmargin-bottom: 3em;\r\n\tborder-collapse:separate;\t\t\t\t\t\t\t \r\n\tempty-cells: show; }\t\t\/* added empty-cells property:show  *\/\r\n\t\r\n\ttable.three {\t\t\r\n\tborder-collapse:separate;\t\t\t\t\t\t\t \r\n\tempty-cells: hide; }\t\t\/* added empty-cells property:hide  *\/\r\n<\/pre>\n<p>Note that the <code>empty-cells<\/code> property only works when the <code>border-collapse<\/code> attribute is set to <code>sepatare<\/code>.<\/p>\n<p>Here are the 3 results we get:<\/p>\n<figure id=\"attachment_3352\" aria-describedby=\"caption-attachment-3352\" style=\"width: 616px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table10.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3352\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table10.jpg\" alt=\"Empty-Cells Property\" width=\"616\" height=\"722\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table10.jpg 616w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table10-256x300.jpg 256w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><figcaption id=\"caption-attachment-3352\" class=\"wp-caption-text\">Empty-Cells Property<\/figcaption><\/figure>\n<p>In this case, to demonstrate the empty-cells property, I removed the first table heading from the html as below:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;tr&gt;\r\n    &lt;th&gt;&lt;\/th&gt;           &lt;!-- removed text from here to have an empty cell --&gt;\r\n    &lt;th&gt;Surname&lt;\/th&gt; \r\n    &lt;th&gt;Age&lt;\/th&gt;\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p><\/p>\n<h3>3.4 The &#8216;colspan&#8217; Attribute<\/h3>\n<p><code>colspan=\"\"<\/code> &#8211; defines the number of columns a cell should span.<\/p>\n<p><strong>This attribute is given inside the <code>th<\/code> or <code>td<\/code> opening tag in html<\/strong>.<\/p>\n<p>The number is put inside the quotes. It can be useful when you need different divisions of cells for different rows.<\/p>\n<p>Application of the <code>colspan<\/code> attribute is as follows:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;tr&gt;\r\n    &lt;th colspan=&quot;2&quot;&gt; FULL NAME&lt;\/th&gt;  \r\n    &lt;!-- removed second th and added a colspan on the first --&gt;\r\n    &lt;th&gt;AGE&lt;\/th&gt;\r\n&lt;\/tr&gt;\r\n&lt;!-- other rows here --&gt;\r\n&lt;tr&gt;\r\n    &lt;td colspan=&quot;2&quot;&gt;Average Age&lt;\/td&gt;\r\n    &lt;!-- removed second th and added a colspan on the first --&gt;\r\n    &lt;td&gt;22&lt;\/td&gt;\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p>In the browser, the table would looke like this:<\/p>\n<p><figure id=\"attachment_3372\" aria-describedby=\"caption-attachment-3372\" style=\"width: 591px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/css-table12.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3372\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/css-table12.jpg\" alt=\"Colspan Attribute Applied\" width=\"591\" height=\"406\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/css-table12.jpg 591w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/css-table12-300x206.jpg 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/a><figcaption id=\"caption-attachment-3372\" class=\"wp-caption-text\">Colspan Attribute Applied<\/figcaption><\/figure><br \/>\n<\/p>\n<h3>3.5 Table Design<\/h3>\n<p>Professional looking tables come with some simple and eye-catching design.<\/p>\n<p>There is a pseudo-selector in css that we call went we want specific elements (the child) to be the same out of a larger element (the parent). This is the <code>nth-child()<\/code>. Inside the brackets we add a condition. Lets see the code below:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\t&lt;style type=&quot;text\/css&quot;&gt;\r\n\t\r\n\ttable {\r\n\tfont-family: &quot;Lato&quot;,&quot;sans-serif&quot;;\t}\t\t\/* added custom font-family  *\/\r\n\t\r\n\ttable.one {\t\t\t\t\t\t\t\t\t \r\n\tmargin-bottom: 3em;\t\r\n\tborder-collapse:collapse;\t}\t\r\n\t\r\n\ttd {\t\t\t\t\t\t\t\/* removed the border from the table data rows  *\/\r\n\ttext-align: center;     \r\n\twidth: 10em;\t\t\t\t\t\r\n\tpadding: 1em; \t\t}\t\t\r\n\r\n\tth {\t\t\t\t\t\t\t  \/* removed the border from the table heading row  *\/\r\n\ttext-align: center;\t\t\t\t\t\r\n\tpadding: 1em;\r\n\tbackground-color: #e8503a;\t     \/* added a red background color to the heading cells  *\/\r\n\tcolor: white;\t\t}\t\t\t      \/* added a white font color to the heading text *\/\r\n\r\n\ttr {\t\r\n\theight: 1em;\t}\r\n\r\n\ttable tr:nth-child(even) {\t\t      \/* added all even rows a #eee color  *\/\r\n        background-color: #eee;\t\t}\r\n\r\n\ttable tr:nth-child(odd) {\t\t     \/* added all odd rows a #fff color  *\/\r\n\tbackground-color:#fff;\t\t}\r\n\r\n\t&lt;\/style&gt;\r\n<\/pre>\n<p>Other elements we changed to enhance the better-looking aspects:<\/p>\n<p>1. <code>font-family<\/code> &#8211; adding a custom font of yours can be a significant improvement to the design of the table<br \/>\n2. <code>border<\/code> &#8211; removing the border of the table and table cells will give it a cleaner and flatter view.<br \/>\n3. <code>even<\/code> and <code>odd<\/code> row colors &#8211; it makes information inside the table easier to catch.<\/p>\n<p>Now look at this pleasant table view we get:<\/p>\n<figure id=\"attachment_3362\" aria-describedby=\"caption-attachment-3362\" style=\"width: 585px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table11.jpg\"><img decoding=\"async\" class=\"size-full wp-image-3362\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table11.jpg\" alt=\"A Final View at our Table\" width=\"585\" height=\"400\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table11.jpg 585w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/css-table11-300x205.jpg 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/a><figcaption id=\"caption-attachment-3362\" class=\"wp-caption-text\">A Final View at our Table<\/figcaption><\/figure>\n<p><\/p>\n<h3>4. Conclusion<\/h3>\n<p>CSS Tables are a great way to organise information inside a webpage as long as we need to structure information.We use them heavily when we want to have our fully customized properties applied regarding the styles and design.<\/p>\n<p>At other cases, you may also use a framework like Bootstrap to create tables faster and with a default style.For more practice on css tables and ideas on table design, check the source files below.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/CSS-Tables.zip\"><strong>CSS Tables<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages are loaded with a lot of information, it sometimes becomes a neccesity organising data in a more easy-to-read and intuitive way. That is where CSS can be of great &hellip;<\/p>\n","protected":false},"author":75,"featured_media":917,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-3220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CSS Table Design Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Table Design Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/fabiocimo\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-09T09:15:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-09T07:16:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fabio Cimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fabiocimo\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fabio Cimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\"},\"author\":{\"name\":\"Fabio Cimo\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\"},\"headline\":\"CSS Table Design Example\",\"datePublished\":\"2015-04-09T09:15:47+00:00\",\"dateModified\":\"2018-01-09T07:16:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\"},\"wordCount\":2853,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\",\"name\":\"CSS Table Design Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"datePublished\":\"2015-04-09T09:15:47+00:00\",\"dateModified\":\"2018-01-09T07:16:52+00:00\",\"description\":\"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSS Table Design Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\",\"name\":\"Fabio Cimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"caption\":\"Fabio Cimo\"},\"description\":\"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.\",\"sameAs\":[\"https:\/\/www.facebook.com\/fabiocimo\",\"https:\/\/al.linkedin.com\/in\/fabiocimo\",\"https:\/\/x.com\/fabiocimo\",\"https:\/\/www.youtube.com\/fabiocimo1\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Table Design Example - Web Code Geeks - 2026","description":"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/","og_locale":"en_US","og_type":"article","og_title":"CSS Table Design Example - Web Code Geeks - 2026","og_description":"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages","og_url":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/fabiocimo","article_published_time":"2015-04-09T09:15:47+00:00","article_modified_time":"2018-01-09T07:16:52+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","type":"image\/jpeg"}],"author":"Fabio Cimo","twitter_card":"summary_large_image","twitter_creator":"@fabiocimo","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Fabio Cimo","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/"},"author":{"name":"Fabio Cimo","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22"},"headline":"CSS Table Design Example","datePublished":"2015-04-09T09:15:47+00:00","dateModified":"2018-01-09T07:16:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/"},"wordCount":2853,"commentCount":2,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/","url":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/","name":"CSS Table Design Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","datePublished":"2015-04-09T09:15:47+00:00","dateModified":"2018-01-09T07:16:52+00:00","description":"The aim of this example is to show\u00a0how\u00a0you can create tables with HTML and style them with CSS, including specific and various examples. Since web pages","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/css\/css-table-design-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.webcodegeeks.com\/category\/css\/"},{"@type":"ListItem","position":3,"name":"CSS Table Design Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22","name":"Fabio Cimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","caption":"Fabio Cimo"},"description":"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.","sameAs":["https:\/\/www.facebook.com\/fabiocimo","https:\/\/al.linkedin.com\/in\/fabiocimo","https:\/\/x.com\/fabiocimo","https:\/\/www.youtube.com\/fabiocimo1"],"url":"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/3220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=3220"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/3220\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/917"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=3220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=3220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=3220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}