Jump to content

Recommended Posts

Hi all

Anyone have any idea why some browsers create a huge gap underneath floats when using either <div> or <br /> styled with clear:both, and how to avoid it? it normally happens within a DIV that has a margin of, say, 200px to allow for a left-floated menu that sits outside of it. when i remove the menu, and the margin, the problem goes away.

cheers
Mark
Link to comment
https://forums.phpfreaks.com/topic/25155-general-question-about-clearboth/
Share on other sites

If you use margin: 200px then its going to add a 200px margin on all sides and thus you get a gap when your use clear:both. Just apply the margin/padding to the side you want it on:
margin-left: 200px

Or float the left and right elements to the left then you don't need to worry about adding margins to position the element on the right. The elements will but-up-against each other.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.