...

View Full Version : CSS DIV positioning question



autechre
07-02-2010, 04:58 PM
Hello all,

I am new to this forum and also new to CSS. I have a site that was built totally with tables and now i am slowly trying to build my site in CSS. Things are looking OK, except for a few little issues...

I have attached an image of what my site looks like now. As you can see the links on the left are not aligned properly with the gallery (main content area). Someone suggested i float the links to the left and the gallery to the right and then clear both. That didnt seem to work. Can someone help me out?

Thanks in advance!

SB65
07-02-2010, 05:02 PM
Got a link to your page? Otherwise we're just guessing...

autechre
07-02-2010, 05:13 PM
here is the link :

http://swdwebdesign.com/divd/divs.html

SB65
07-02-2010, 05:21 PM
You have #sidebar1 floated, with a width of 180px, and then #maincontent next to it with css:


#maincontent {
clear:both;
float:right;
margin:-120px 0 0 195px;
}

clear:both means the div will come below any content floated on either side as this says that floated elements are not allowed on either (both) side of the div. You're compensating for this with the negative top margin. Finally, there's no need to float this div as you have allowed space for #sidebar1 with your 195px left margin. So, have a try with:


#maincontent {
margin-left:195px;
}

Have a look here (http://css.maxdesign.com.au/floatutorial/) for some info on floats and here (http://bonrouge.com/3c-hf-fluid-lc.php) for some layouts.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum