to create table using css | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

to create table using css

creat a table

23rd Apr 2017, 7:38 PM
Trinadh MaNikanta Gangadhar Dangeti
Trinadh MaNikanta Gangadhar Dangeti - avatar
3 Answers
+ 6
If you have to make a table object ( for present some table formatted data ) in your html page, use the <table><tr><td></td></tr></table> html element/structure, and style it with css ^^ If you have to make a table layout ( to organize/build your html page content ), use the most adapted html elements ( regarding their semantical meaning ) to your content, and change their default value of 'display' css property to one of 'table'-family, to recreate same kind of structure that's using for <table> html element/structure... using generic <div>s html elements: <div class="myTable"> <div class="myRow"> <div class="myCell"> my first cell content </div> <div class="myCell"> my second cell content </div> <div class="myCell"> my third cell content </div> </div> </div> <style> .myTable { display:table; table-layout:fixed; /* default: auto / use for change rule of size calculation ( content adapted or not ) */ border-collapse:separate; /* collapse or separate borders of cells */ border-spacing:5px 10px; /* space between separate borders of cells ( old and deprecated 'cellspacing' html attribute ) */ border:2px solid red; /* style of global 'table' box border -- not cells borders ^^ */ } .myRow { display:table-row; /* almost styles applied to a 'table-row' ( including <tr> ) are not applied to it but to the 'table-cell' childs */ } .myCell { display:table-cell; border:1px solid blue; /* style of cell borders */ padding:20px; /* equivalent to old deprecated 'cellpadding' html attribute '*/ } </style>
24th Apr 2017, 5:26 PM
visph
visph - avatar
+ 2
make a table with html and the use css for the style
23rd Apr 2017, 8:00 PM
Amjad
Amjad - avatar
+ 2
With Css you cannot make any tables. Use html
23rd Apr 2017, 8:01 PM
weAreTheOne
weAreTheOne - avatar