PDA

View Full Version : problem in css and xhtml



desperateboy
30 Oct 2007, 12:37 AM
hi
I am trying to create a two-column layout using XHTML and CSS. I'm having a problem having the text in the second column start at the top of the column. How do I make sure that the text will go to the top of the second column?
I don't get any reply from web site design forum (http://www.wbdesigningcompany.net) 's forum .I am registered with site.If u got my problem,Give relevant solution.
Thanks in advance.

Wickham
30 Oct 2007, 02:05 AM
If you are using two div boxes side by side then the text in both should start at the top; unless padding or margins are different in one of the divs.

Set both divs with 0 margins and padding and see if that makes a difference. There can also be a problem with default top margin or padding on the p tag (I can never remember which it is) which is more in Firefox than in IE so make sure the p tag has the same margin and padding for all browsers.

In the head section add the style tags:-
<style type="text/css">
div { padding: 0; margin: 0; }
p { padding-top: 3px; margin-top: 3px; }
</style>

Then look at your page in IE and Firefox. Adjust the padding or margins as required, but they should be the same in both divs and all browsers.

If you have an image in the left div and atext in the right div then the top margin or padding may be different on the image tag, so again set this to 0 and see if it makes a difference:-
img { padding-top: 0px; margin-top: 0px; }

See also
http://www.wickham43.supanet.com/tutorial/threecolumns.html