Very noobish text question

Kaiserman

New Member
Hi everyone. Sorry to be yet another noob asking yet another noob question, but this looks like a great forum.

When I place a paragraph of text in a table, I can set the margins etc in the CSS, but why does the text automatically just sit in the middle of the table? No matter what I do I can't seem to find any way for it to default to the top of the table Apart from 'bumping' it up by adding in &nbsp's :confused:

Help much appriciated!
 

notarypublic

New Member
If I'm understanding this correctly, you're using a table-based layout and the content is sitting in the middle of the cell, instead of aligning to the top like you would want it to?

This is one of the reasons to consider switching to an entirely CSS-based layout, using div's and spans; if you're editing the code by hand, you've got your work cut out for you.

By default, tables will vertically center content inside of a cell. People usually don't notice this when they're tailoring a table's size around their content, until one cell has more data in it than the cell next to it.

If you're using Dreamweaver it's a relatively easy fix. Select the table and then go to the properties tab, and change the align attribute to 'top.' But if you're using CSS to change margins, you should consider using CSS for most of they layout anyway. Here is a good article to get you started.

Best of luck!
 

Kaiserman

New Member
If I'm understanding this correctly, you're using a table-based layout and the content is sitting in the middle of the cell, instead of aligning to the top like you would want it to?

This is one of the reasons to consider switching to an entirely CSS-based layout, using div's and spans; if you're editing the code by hand, you've got your work cut out for you.

By default, tables will vertically center content inside of a cell. People usually don't notice this when they're tailoring a table's size around their content, until one cell has more data in it than the cell next to it.

If you're using Dreamweaver it's a relatively easy fix. Select the table and then go to the properties tab, and change the align attribute to 'top.' But if you're using CSS to change margins, you should consider using CSS for most of they layout anyway. Here is a good article to get you started.

Best of luck!


That's it - thanks a trillion! Thanks for all the other guides too.
 

Mug

New Member
Don't use tables for main layouts unless you are building emails. Put your content in a div and then apply the following css:

width: xxem;
margin: 0 auto;
padding: 0 auto;


You should replace the xx with a number.
 
Top