extra vertical space in IE after div clear

前端 未结 6 991
感情败类
感情败类 2021-01-05 02:06

I have created a simple grid of divs by left floating them and an empty div with a clear at the end of each row.

This works fine in Firefox, but in IE I get extra ve

6条回答
  •  臣服心动
    2021-01-05 02:58

    IE is a bit funny about empty

    s - it likes to give them the height of a line of text.

    If you change .clear to this, it'll shrink to 1 pixel:

        .clear {
            clear: both;
            height: 1px;
            overflow: hidden;
        }
    

    Put a background colour on to see what's happening

提交回复
热议问题