Sign in to follow this  

[web] use something else instead of tables

This topic is 3633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
You can place both texts in div or span elements and use the float attribute in CSS to align them.

#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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

This topic is 3633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this