Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Left floating <div> & Right floating <div>

Featured Replies

Hi!!

 

As per the title topic, i have got 2 floating <div>'s 1 of them is floating to the left, and the other is floating to the right. The <div> floating to the right has got more content than the <div> floating to the left. The <div> floating to the right stick to the top of the footer, the left floating <div> has a gap between it and the top of the footer meaning that you are able to see the background.

 

How do i make the 2 <div> stick to the top of the footer?

 

Thanks

 

Tyler

post-5080-1242788445_thumb.jpg

  • Author

Hopefully someone can help me :D I gota show the finished site to the client at 11am TODAY LOL

wrap them both in a div e.g. div class="container"

.container {background:#fff;float:left;}

 

if the float ends up breaking your layout then use this instead:

.container {background:#fff;overflow:visible;}

  • Author

Thank guys!

 

Next problem i have, is in IE, the the left floating <div> sticks to the top as i want, but the right floating <div> goes below the other one but still on the left hand side.

What about if you give your content wraping div a white background the gaps wont show up as badly?? just going by the photo above??

 

Hope it helps. :)

  • Author
What about if you give your content wraping div a white background the gaps wont show up as badly?? just going by the photo above??

 

Hope it helps. :)

 

I have the first problem solved lol

 

re-read my post above for my new problem lol

So you mean it does something like this?

 

.....[c2]

[c1].....

 

Where as you want

 

[c1][c2]

 

 

Got a link? If a float is forced down, it tends to be a box model issue that causes this (i.e to wide to fit in the allocated space, so it shoves one down below).

I have the first problem solved lol

 

re-read my post above for my new problem lol

 

Sorry skim reading not paying attention! :rolleyes:

 

 

Same as bocaj need a link or some code I think. so the right float is on the left only in IE??

  • Author
Sorry skim reading not paying attention! :rolleyes:

 

 

Same as bocaj need a link or some code I think. so the right float is on the left only in IE??

 

Yeah exactly!! Its works perfect in firefox, but as per usual not in IE :(

 

link

 

http://www.drumcornfarmcottage.co.uk/pricing.html

Apply overflow: hidden; to both floats, IE5 & 6 has an issue that occurs when using xhtml, in that some elements that use indented code it creates extra spacing (mis-interprtation of white space?).

 

Applying overflow:hidden; to both floats will fix it.

 

I don't know what side effects this may have with other browsers, so you can always wrap it in a conditional comment for any ie's less than ie7

 

This fix will only work if the required dimensions have been specified. Your issue lies with the left and right side, so a width must be specified (which you've done, so it's fine). The same fix will work for top and bottom too, but only when a height is specified.

Quick CSS hack to apply what bocaj said just to IE6:

* html #main-content, * html #main-sidebar {overflow:hidden;}

Just add to end of CSS file

If you are still having problems try this:

 

#footer {clear:both}

 

then of course make the div id of the footer, footer

 

<div id="footer"></div>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.