Why clear: right doesn't work as intended

后端 未结 2 1331
故里飘歌
故里飘歌 2021-02-01 20:15

I\'m always confused by clear: left, clear: right and clear: both in CSS. I know clear: both means it doesn\'t allow floating

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 20:53

    You can have a clear that works after the div if you use:

    .clr::after
    {
     content: "";
     clear: both;
     display: block;
     height: 0;
     visibility: hidden;
    }
    

提交回复
热议问题