What is the problem with css br clear?

I came across this article http://www.thefloatingfrog.co.uk/css/my-hatred-of-br-clearall/

When will you need to use it? Why is this evil? I do not understand the syntax of substitution, which you can explain?

+3
source share
5 answers

Set cleanup for both, preventing other elements from floating on the left or right side of the element. The next class is an easy way to add this anywhere.

.clear {
    clear:both;
}

So, when you want to clear something (that is, if you were to float the next element to the left, it would be below the current element and to the left, and not to the left of it), you would simply add a .clear class.

, , "-", HTML- "clear" = "" "-".

<div class="something">Cool content.</div>
<br clear="all">
<div class="other">Cool content again.</div>

- :

.something {
    float: left;
}
.other {
    clear :both;
    float: left;
}

<div class="something">Hi!</div>
<div class="other">Hi again from below!</div>

, "" , "clear: both;" CSS .

+2

- , , , , , .

, , , , CSS , , , , . ? , -, , , (, ) (, , ), CSS . CSS - .

, ​​, , , . ? , <br clear="all">, , , . . , .

CSS, , , , , . , clear, floats. , .

+2

, . , , . , correct .

, , , , , , .

+1

, CSS DIV. , "clear".

, . - -, HTML, br, , CSS HTML, , .

A reasonable excuse as these simple, dumb lines of code can cause a lot of headaches.

+1
source

Source: https://habr.com/ru/post/1784307/


All Articles