HTML Tables: OK / CSS Tables: Error !!!

OK i know this topic doesn't make a lot of sence since its more like a computer wrote it but i was wondering if you can do tables in CSS .Originally posted by Kaisa
wondering if you can do tables in CSS .

Yes, but why?
If you have tabular data use a <table>.I was wondering if you could and if so it would be easy like:

Table.TableDiv{ Color:Red;background-color:red}

<div class="TableDiv">
<table>
</table>
</div>

can't you do it like that and set custom colors and stuff for it without having to put in every time or anything. (I think its table without the .TableDiv thing but i am not sure)You can make anything display as if it was part of a table with the display property but the support is more than poor and it doesn't make it a real table.

I'm wondering if what you want isn't to style an ordinary table? In that case the answer is yes, style away! :DOriginally posted by Kaisa
Table.TableDiv{ Color:Red;background-color:red}

<div class="TableDiv">
<table>
</table>
</div>


that won't work, but this will

table.tableDiv{ Color:Red;background-color:red}

<table class="tablediv">
</table>


Of cource red text on red background isn't the best :DWell thats just a exampleAnd, wherever you have your css, you can also go

td { background-color: black; color: white }

or

.class_name { background-color: black; color: white }
.class_name2 { background-color: silver; color: black }

and then in your table

<table>
<tr>
<td class="class_name">This would be black background with white text</td>
<td class="class_name2">This would be silver background with black text</td>
</tr>
</table>Originally posted by khayman2001

.class_name { background-color: black; color: white }


JFYI
It's usually not recomended to use _ in CSS selector names.
While it is alowed in the CSS spec nowdays, that was not true in the beginning. Thus many older browsers will ignore the rules of such selectors becuse it used to be incorrect.

If you want to separate words in selectors for readablility, a better suggestion is to use eg a hyphen ie .class-nameYeah, sorry about that... brain doesn't function correctly until noon, at the earliest.
 
Back
Top