Firefox body margin bug?

后端 未结 3 1061
一向
一向 2020-12-11 07:00

I have this simple example:

  • Item
  • Item
  • Item
相关标签:
3条回答
  • 2020-12-11 07:05

    This is, without a doubt, a bug. The margin is definitely not supposed to be there.

    • According to Firebug, the only non-zero margin that is computed that I can see is the same margin-bottom: 100px on your header element as in your CSS. Everything else is zero.

    • Even Firebug's DOM inspector has trouble identifying it; it never highlights that region, with the obvious exception of when you're inspecting html itself (which it highlights as part of its content area).

    I found tons of bug reports which were closed as duplicates of this one, with numerous more test cases. Plus, it looks like it has been around since at least Firefox 2.

    0 讨论(0)
  • 2020-12-11 07:18

    you can use {padding-bottom:100px;} instead of margin to achieve this ..

    0 讨论(0)
  • 2020-12-11 07:22

    Instead of polluting your code with non-semantic and unnecessary empty <li>-s just add overflow: hidden to your <ul>

    HTML

    <header>
        <ul>
            <li>Item</li>
            <li>Item</li>
            <li>Item</li>
            <li>Item</li>
        </ul>
    </header>
    <section>section</section>
    

    CSS

    ul {
        list-style-type: none;
        overflow: hidden;
    }
    

    DEMO

    0 讨论(0)
提交回复
热议问题