Div height:0px does not work?

后端 未结 10 1275
既然无缘
既然无缘 2020-12-05 04:42

Setting a div height to 0px does not seem to work.

The div expands to show it

相关标签:
10条回答
  • 2020-12-05 04:59

    Try to also set line-height: 0;

    And if you want to hide your div completely, use display: none;

    0 讨论(0)
  • 2020-12-05 04:59

    Try overflow:hidden

    0 讨论(0)
  • 2020-12-05 05:05

    You haven't said which browser you're using, but I'm assuming IE, as it's the only browser I know of which mistakes height for min-height . Like everyone else has already said, overflow:hidden; will work, or line-height: 0;, but you only need one of them.

    Setting height: 0; will have allready triggered IEs hasLayout, so no need for zoom:1; in this case.

    0 讨论(0)
  • 2020-12-05 05:06

    This works for me:

    .zippy{
        padding: 0;
        height: 0;
        overflow: hidden;
    }
    

    Thanks.

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