How does CSS clearing really work?

前端 未结 5 1273
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 03:12

I have a

that I want to be on a line by itself. According to W3Schools, this rule:

div.foo {
  clear: both;
}

...s

5条回答
  •  Happy的楠姐
    2020-12-30 03:38

    I generally do the following for that effect:

    float: left;
    clear: right;
    

    I don't know if it applies merely to the element to which it is applied, though it makes sense.

    The specs are available here, though: http://www.w3.org/TR/REC-CSS2/

提交回复
热议问题