Jump to content

how can i design without tables?


pcman

Recommended Posts

I recommend divs + tables. Tables should only be used for tabular data.

 

You should strive to design SEMANTIC websites - use as few divs as possible to achieve the same design. A typically beginner will create div soup.

 

For example:

<div id="main">
  <div class="heading">I am a heading in a div.</div>
  <div class="text">Text goes here... blah blah</div>
  <div class="image"><img src="../..images/something.png" width="50" height="50" alt="ALT text" /></div>
</div>

 

This is div soup. It isn't any better than tables!

 

You should do this instead:

 

<div id="main">
  <h1>Heading Goes here!</h1>
  <p class="text">Text goes here... blah blah</p>
  <img src="../..images/something.png" width="50" height="50" alt="ALT text" />
</div>

 

Remember, CSS is powerful enough that you can literally format these tags too! Actually, this technique will reduce your code since you don't have to specifiy classes, if you only use a tag once within a div parent.

 

Finally, NEVER enclose text in only a div. This is terrible semantics. Always enclose it in a block level text tag. <li>, <p>, <h1>, etc.

Link to comment
Share on other sites

TheFilmGod is right.

 

AND, once you get rid of all the code bloat (table tags, too many div tags, etc) you will almost immediately notice better natural search engine ranking.

 

SEO is all about making it easy for the bot to spider your pages. Semantic content shows the bot what is important.

Link to comment
Share on other sites

going table less is easier than you may think.  Study the use of float and clear.

 

.floating {
float:left;
margin:5px;
border:1px solid black;
background-color:red;
}

.push {
clear:left;
}

 

<div class="floating"></div>
<div class="floating"></div>
<div class="floating"></div>
<div class="push"></div>

 

This should output 3 red boxes with a black border all on one line separated by 5px.

Without the float:left; they would appear from top to bottom instead of left to right.

float:right would make them display right to left instead of left to right. Use clear to stop floating block objects.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.