.div-table {
display: table;
width: auto;
background-color: #eee;
border: 1px solid #666666;
border-spacing: 5px; /* cellspacing:poor IE support for this */
}
.div-table-row {
display: table-row;
width: auto;
clear: both;
}
.div-table-col {
float: left; /* fix for buggy browsers */
display: table-column;
width: 200px;
background-color: #ccc;
}
Runnable snippet:
.div-table {
display: table;
width: auto;
background-color: #eee;
border: 1px solid #666666;
border-spacing: 5px; /* cellspacing:poor IE support for this */
}
.div-table-row {
display: table-row;
width: auto;
clear: both;
}
.div-table-col {
float: left; /* fix for buggy browsers */
display: table-column;
width: 200px;
background-color: #ccc;
}
<body>
<form id="form1">
<div class="div-table">
<div class="div-table-row">
<div class="div-table-col" align="center">Customer ID</div>
<div class="div-table-col">Customer Name</div>
<div class="div-table-col">Customer Address</div>
</div>
<div class="div-table-row">
<div class="div-table-col">001</div>
<div class="div-table-col">002</div>
<div class="div-table-col">003</div>
</div>
<div class="div-table-row">
<div class="div-table-col">xxx</div>
<div class="div-table-col">yyy</div>
<div class="div-table-col">www</div>
</div>
<div class="div-table-row">
<div class="div-table-col">ttt</div>
<div class="div-table-col">uuu</div>
<div class="div-table-col">Mkkk</div>
</div>
</div>
</form>
</body>
Answer from Shiva Komuravelly on Stack OverflowW3Schools
w3schools.com βΊ css βΊ css_table.asp
CSS Styling Tables
The CSS border-collapse property sets whether table borders should collapse into a single border or be separated as in standard HTML.
W3Schools
w3schools.com βΊ html βΊ html_tables.asp
HTML Tables
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
html - How create table only using tag and Css - Stack Overflow
I want to create table only using tag and CSS. This is my sample table. More on stackoverflow.com
Tables in HTML
I use tables when I actually need a table. I'm talking about showing data or information in a way that a table was originally meant for. For everything else I'm using grid, flexbox, etc. What's gone are the days of using tables for layout purposes. I think the only time I ever see people using tables for layout purposes are in HTML emails. I've been using the MJML library, but even when I look at the source code it generates, it has tables in there. More on reddit.com
37 Simple and Useful Table Templates & Examples for Web Developers
Tables? Maybe for the .00001% cases where grid and flex don't work. More on reddit.com
Are tables still used to create a layout?
By "no CSS" do you also mean no style tags? No style attributes? Without CSS, tables are the only way to create that design. Tables should generally not be used for page layout, but if you can't use CSS, you have bigger concerns than best practices. More on reddit.com
Videos
03:58
Learn HTML tables in 3 minutes π - YouTube
06:34
How to Create and Style a Table with HTML & CSS | Step by Step ...
27 | HOW TO CREATE & STYLE TABLES IN HTML | 2023 | Learn HTML and ...
11:53
π₯ How to Design a Stunning Table Using CSS (Step-by-Step Tutorial!)
05:25
How to make Simple Table Design Using HTML & CSS - YouTube
06:22
HTML Tables: Full HTML/CSS/JS Course - YouTube
MDN Web Docs
developer.mozilla.org βΊ en-US βΊ docs βΊ Learn_web_development βΊ Core βΊ Styling_basics βΊ Tables
Styling tables - Learn web development | MDN
October 14, 2025 - To do this, add the following to the bottom of your style.css file: ... There is nothing remarkable here, except for the caption-side property, which has been given a value of bottom. This causes the caption to be positioned on the bottom of the table. ... html { font-family: "Helvetica", "Arial", sans-serif; } table { table-layout: fixed; width: 90%; margin: 10px auto; border-collapse: collapse; border-top: 1px solid #999999; border-bottom: 1px solid #999999; } th, td { vertical-align: top; padding: 0.6em; } tr :nth-child(2), tr :nth-child(3) { text-align: right; width: 15%; } tr :nth-child(1
Piccalilli
piccalil.li βΊ blog βΊ styling-tables-the-modern-css-way
Styling Tables the Modern CSS Way - Piccalilli
Our table columns should now all have equal widths, but we might want our a different size for our first column (which contains the row headers). If we set a width on the first <th> element, we can then see that the remaining horizontal space will be distributed evenly between the rest of the columns. ... Go ahead and toggle the HTML or CSS panel to see how our table responds, responsively.
W3Schools
w3schools.com βΊ css βΊ css_table_style.asp
CSS Table Styling
CSS Reference CSS Selectors CSS Combinators CSS Pseudo-classes CSS Pseudo-elements CSS At-rules CSS Functions CSS Reference Aural CSS Web Safe Fonts CSS Animatable CSS Units CSS PX-EM Converter CSS Colors CSS Color Values CSS Default Values CSS Browser Support ... To add some more space between the inner borders and the content in a table, use the padding property on <td> and <th> elements:
FreeFrontend
freefrontend.com βΊ css-tables
25 CSS Tables | FreeFrontend
This collection offers modern solutions for table layout and styling that go beyond standard HTML. Responsive techniques that transform rows into cards on mobile devices using attr(data-label) are detailed. Visual enhancements include βzebra stripingβ via :nth-child, hover highlighting, and fixed headers with position: sticky. For complex layouts, CSS Grid implementation is demonstrated, providing flexible column control and scrollable areas with pinned elements.
GeeksforGeeks
geeksforgeeks.org βΊ css βΊ css-tables
CSS Tables - GeeksforGeeks
With CSS, you can adjust borders, spacing, colors, alignment, and even add hover effects to make data more organized and visually appealing. ... <html> <head> <style> table { width: 50%; border-collapse: collapse; margin: 20px auto; } th, td ...
Published Β November 4, 2025
Top answer 1 of 11
302
.div-table {
display: table;
width: auto;
background-color: #eee;
border: 1px solid #666666;
border-spacing: 5px; /* cellspacing:poor IE support for this */
}
.div-table-row {
display: table-row;
width: auto;
clear: both;
}
.div-table-col {
float: left; /* fix for buggy browsers */
display: table-column;
width: 200px;
background-color: #ccc;
}
Runnable snippet:
.div-table {
display: table;
width: auto;
background-color: #eee;
border: 1px solid #666666;
border-spacing: 5px; /* cellspacing:poor IE support for this */
}
.div-table-row {
display: table-row;
width: auto;
clear: both;
}
.div-table-col {
float: left; /* fix for buggy browsers */
display: table-column;
width: 200px;
background-color: #ccc;
}
<body>
<form id="form1">
<div class="div-table">
<div class="div-table-row">
<div class="div-table-col" align="center">Customer ID</div>
<div class="div-table-col">Customer Name</div>
<div class="div-table-col">Customer Address</div>
</div>
<div class="div-table-row">
<div class="div-table-col">001</div>
<div class="div-table-col">002</div>
<div class="div-table-col">003</div>
</div>
<div class="div-table-row">
<div class="div-table-col">xxx</div>
<div class="div-table-col">yyy</div>
<div class="div-table-col">www</div>
</div>
<div class="div-table-row">
<div class="div-table-col">ttt</div>
<div class="div-table-col">uuu</div>
<div class="div-table-col">Mkkk</div>
</div>
</div>
</form>
</body>
2 of 11
93
divs shouldn't be used for tabular data. That is just as wrong as using tables for layout.
Use a <table>. Its easy, semantically correct, and you'll be done in 5 minutes.
Flowbite
flowbite.com βΊ docs βΊ components βΊ tables
Tailwind CSS Table - Flowbite
Get started with multiple variants and styles of these table components built with the utility classes from Tailwind CSS and components from Flowbite. Use the following example of a responsive table component to show multiple rows and columns of text data. Edit on GitHub Β· Toggle full view Β· Toggle full screen Β· Toggle tablet view Β· Toggle tablet view Β· Toggle mobile view Β· Toggle mobile view Β· RTL Β· Toggle RTL mode Β· Toggle dark/light mode Β· Toggle dark mode Β· Loading... HTML Β·
Shay Howe
learn.shayhowe.com βΊ html-css βΊ organizing-data-with-tables
Organizing Data with Tables - Learn to Code HTML & CSS
Today tables are used specifically for organizing data (like they should be), and CSS is free to get on with the jobs of positioning and layout. Building data tables still has its challenges. How a table should be built in HTML depends largely on the data and how it is to be displayed.
DigitalOcean
digitalocean.com βΊ community βΊ tutorials βΊ how-to-style-a-table-with-css
How to Format and Style HTML Tables Using CSS | DigitalOcean
July 18, 2025 - Learn how to style an HTML table with CSS using borders, padding, and zebra stripes. Follow this step-by-step guide to create clean and accessible tables today.
Codecademy
codecademy.com βΊ forum_questions βΊ 54e3e5b686f552e77500148e
CSS and tables | Codecademy
(part 5) Notice how much easier it is to replicate these tables than if they were full of img elements with src attributes? Whatβs more is we can still lay content over top of the image, namely, data. Letβs add some captions to each image. This time we have to get into the HTML.
TablesGenerator
tablesgenerator.com βΊ html_tables
HTML Tables generator β TablesGenerator.com
The generated code consists of two parts: <style> tag and <table> tag. The first one should be copied and put just before the </head> tag of your website, while the latter (i.e. table code) should be placed in the desired location. As you probably noticed there is a select box "--Table theme--" ...
Colorlib
colorlib.com βΊ home βΊ website templates βΊ 29 beautiful css3 table templates & examples [html] 2025
29 Beautiful CSS3 Table Templates & Examples [HTML] 2025
August 14, 2025 - Please do if you want to brand any of the two table designs. You can change the color and make them follow your regulations precisely. These support MANY different aims and intentions, catering to various purposes. Create a class timetable or share other information; anything is possible. Download Preview Β· These HTML5 & CSS3 tables have highlights for vertical and horizontal rows.
GeeksforGeeks
geeksforgeeks.org βΊ html βΊ html-tables
HTML Tables - GeeksforGeeks
<!-- index.html --> <!DOCTYPE html> ... <td>41</td> </tr> </table> </body> </html> ... Uses border-collapse: collapse; and border properties to create a clean, single-bordered table....
Published Β 1 month ago
DataFlair
data-flair.training βΊ blogs βΊ html-tables
HTML Tables - CSS Styling Tables - DataFlair
July 26, 2024 - HTML Tables are of utmost importance for the systematic representation of data. In this article, weβve looked at the creation of tables using the <table>, <tr> and <td> tags. Weβve also looked at the formatting of tables using CSS, such as setting alignment, padding, border-collapse, background, caption, column and row spanning, etc.
DEV Community
dev.to βΊ dcodeyt βΊ creating-beautiful-html-tables-with-css-428l
Table CSS: Creating beautiful HTML tables with CSS - DEV Community
September 6, 2022 - Let's write some boilerplate HTML code for the table. <table class="styled-table"> <thead> <tr> <th>Name</th> <th>Points</th> </tr> </thead> <tbody> <tr> <td>Dom</td> <td>6000</td> </tr> <tr class="active-row"> <td>Melissa</td> <td>5150</td> </tr> <!-- and so on... --> </tbody> </table> ... .active-row which will be the "active" row - this class is used to highlight a specific row and will get it's own CSS as we'll see soon