Jump to content
  • Advertisement
Sign in to follow this  
Recruit0

[web] use something else instead of tables

This topic is 3943 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
Advertisement
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
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!