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.

Floats affecting footer position

Featured Replies

Hi guys,

 

I have a problem with my CSS, I float the image left, and the text wraps okay. But the footer moves up for some reason, any ideas why?

 

Here is the website

 

The bit in question is the "<div id="footer">" with the green line green line and the "Copyright GBsqd LLC. All Rights Reserved" on it.

 

Thanks!

 

Matt

Add "clear: both" to the footer div so that it reads:

 

#footer {
height: auto;
width: 100%;
border-top: 3px #006837 solid;
width: 800px;
margin: 0 auto;
margin-top: 10px;
text-align: center;
font-size: 8pt;
clear: both;
}

 

Edit: The reason why this fixes your issue is because the "clear" property defines where floated elements cannot be. By setting clear to "both", you're saying that floated elements cannot be on the right or left side, therefore moving the footer below the image

Edited by Pete Prosper

  • Author

Hey Pete,

 

Thanks, that worked great! And I learnt what clears are used for! Have seen them before, not sure what they were for though.

 

Thanks again!

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.