[web] use something else instead of tables
I'm trying to format some text like this:
Type of thing: Description Description Description Description Description
>>>>>>>>>>>>> Description Description Description Description Description
>>>>>>>>>>>>> Description Description Description Description Description
>>>>>>>>>>>>> Description Description
Basically I'm trying to do this without using a table (because tables are evil...or so I've heard). I need the "Type of thing:" on the left and the description on the right (lined up, without those arrows there). A standard 2 column setup... that I can't seem to figure out >.<
This text I'm trying to format is within the "content" section of my site. I have navigation/menu bar on the left, header at the top and content section to the right of the menu.
Don't fall for the "tables are evil" joke. Tables are 100% valid (X)HTML and have full, predictable support in all browsers, which is more than can be said for div-based layouts. Besides, the information you want to format is perfectly suited for tables.
I agree with the above. If the data you wish to format is in a "Foo : bar" form, a table provides the correct semantic for your content.
You can place both texts in div or span elements and use the float attribute in CSS to align them.
But if you have many rows with data like this, it's perfectly okay to use a table; that's what they were intended to be used for in the first place.
#span1{ display: block; background-color: #FF0000; width: 100px; float: left;}#span2{ display: block; background-color: #0000FF; width: 300px;}
<span id="span1">Type of thing:</span><span id="span2">Description Description Description Description Description Description Description Description Description</span>
But if you have many rows with data like this, it's perfectly okay to use a table; that's what they were intended to be used for in the first place.
Tables are perfectly acceptable for tabulated data; when people tell you to avoid tables, they mean that you shouldn't use them to lay out your entire page. If you're trying to show an actual table of data a table may well be the appropriate choice.
The other option you could look into is an appropriately styled definition list (W3Schools reference).
[Edited by - jbadams on January 9, 2008 8:00:58 AM]
The other option you could look into is an appropriately styled definition list (W3Schools reference).
[Edited by - jbadams on January 9, 2008 8:00:58 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement