Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4041494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:53:14+00:00 2026-05-20T12:53:14+00:00

As illustrated in this jsfiddle: http://jsfiddle.net/qrbhb/ If you take this markup: <div>There should be

  • 0

As illustrated in this jsfiddle: http://jsfiddle.net/qrbhb/

If you take this markup:

<div>There should be no gap between us</div>
<br />
<div>There should be no gap between us</div>

and this css:

div {
    background: #999;
}

br {
    clear: both;
    display: block;
    overflow: hidden;
    visibility: hidden;
    width: 0;
    height: 0;
}

All webkit based browsers will display a gap equal to the line height of the parent element, while firefox and IEs will not display a gap. I don’t know who is following the spec here, but I can’t for the life of me get this to display the same in all browsers and it’s driving me crazy. Any ideas?

EDIT: Sorry folks, I was looking at a rather complicated layout and mistakenly thought some elements were floating that weren’t. Floated elements behave as expected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:53:15+00:00Added an answer on May 20, 2026 at 12:53 pm

    Odd. I can see some logic to what’s going on. It seems to be using the line-height from the preceding element as the height. If you add this, for example, just before the <br /> as shown:

    <div class="weird" /><br />
    

    …and then set its line-height:

    div.weird {
        line-height: 0;
    }
    

    (jsFiddle here)

    …then the <br /> loses its height.

    So, I’d guess that the line-break “inherits” — although that’s rather the wrong word — the height of the preceding bit of text. I’m not certain that’s really what’s going on, but it makes the most sense of the explanations I can think of.

    Really, though, I’m with everyone else — if you don’t want a break between lines, don’t use a line-break. If you’re going to go a bit non-semantic for clearing stuff anyway, I’d just live with it and use a <div>; the practical elements of the web community will understand and forgive you 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/AndyMP/fVKDy/ This fiddle illustrates a problem I am trying to solve. The container DIV
http://jsfiddle.net/AndyMP/nUhhf/1/ This is a simplified situation where I have a DIV that animates downwards
Hopefully this JSFiddle should illustrate the issue better than my words: http://jsfiddle.net/pmwRc/6/ I'm displaying
I've set up an example which illustrates my issue: http://jsfiddle.net/XZeYK/5/ If you view this
I've made this to illustrate my issue: http://jsfiddle.net/michaelhart/mUMHZ/ (Only tested in Chrome.) In summary:
I have this example here to illustrate the situation: http://jsfiddle.net/nubrF/40/ If you hold your
Consider the following code ( http://jsfiddle.net/FW36F/1/ ): <input type=checkbox onchange=alert(this.checked)> <button onclick=document.getElementsByTagName('input')[0].checked=!document.getElementsByTagName('input')[0].checked;>toggle</button> If you
We're using this script -- http://jsfiddle.net/6t74T/4/ -- which we learned about in this terrific
I am using this code (much easier to illustrate in a Fiddle): http://jsfiddle.net/rECyh/ I
To try to illustrate, I created the following code: http://jsfiddle.net/Ridermansb/SUcmH/4/embedded/result/ Yellow: This is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.