Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: not2easy

Message Too Old, No Replies

Div not aligning properly

     
2:35 pm on Aug 8, 2010 (gmt 0)

New User

5+ Year Member

joined:Nov 4, 2008
posts: 2
votes: 0


Hello

I'm trying to have 2 divs side by side, but the one on the right always goes below it, here is the link to the site [urlgone.com...] the link takes about 5 seconds to redirect to the site.


How can I make the div that contains "Latest Articles go by the side of the menu?


Best Regards
6:15 pm on Aug 8, 2010 (gmt 0)

New User

5+ Year Member

joined:Aug 8, 2010
posts:4
votes: 0


I think removing "float: right" from "div.rightPart" and add "float: left" to "div.mainMenu" could help! (I'm not sure)
6:27 pm on Aug 8, 2010 (gmt 0)

Full Member

joined:July 31, 2005
posts: 272
votes: 0


If you want to control the spacing between the two divs that are side by side, put both of the divs in a wrapper div. Float one left and the other right. Set a width for the wrapper div and center it with: margin: 0 auto;

Example [paynelessdesigns.pastebin.com]
11:22 am on Aug 18, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 28, 2009
posts:57
votes: 0


You could remove the float property and set it to display:inline-block; (then add margin-left to the first one to space it out if required.)

It is possible that if the float property is pushing it underneath that maybe there isn't enough space in the wrapper div for the two elements to sit side by side. To test this leave your code as is with the float properties and reduce the width of the second div to see if you can sit it next to it.
4:18 pm on Aug 26, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Mar 12, 2010
posts:65
votes: 0


I'm with MP on this. This is the basic code I use for a centred 3 column website. Hope it helps.

<div id="wrapper"></div>
<div id="sidenav"></div>
<div id="sidebar"></div>
<div id="content"></div>
</div>

#wrapper{width:780px; height:800px; margin:10px auto;}
#sidenav{width:80px; height:800px; float:left;}
#sidebar{width:80px; height:800px; float:right;}
#content{width:605px; height:800px; float: left; margin: 0px 10px;}

PS: I always make my biggest div (content) 2 to 5px smaller than width of sidebar + width of sidenav + 10px margin of content - the width of the wrapper.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members