M
M
modfop2017-02-04 19:10:04
css
modfop, 2017-02-04 19:10:04

What if we use overflow: hidden instead of clearfix?

There is such a popular trick in layout as clearfix. This trick is mostly used in situations like here .
Without clearfix, this would happen . That is, blocks with floats fall out of the stream.
But what if you solve the problem without using clearfix, just setting the parent "overflow: hidden". Here is an example . It will turn out less code without any extraneous tricks / hacks. Or is there some kind of trick?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iBird Rose, 2017-02-04
@modfop

Or is there some kind of trick?

well, read about the overflow: hidden property. what it was originally intended for. then you will see the catch yourself) you will not be able to endure anything beyond the boundaries of this element as an absolute, for example.
ps and so the method is working yes. as he himself wrote "less code, etc.", but if you need something to go beyond the container, this method disappears.

S
serf, 2017-02-04
@serf

htmlbook.ru/css/haslayout

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question