Relative positioning + Absolute positioning VS Floats Left a Float Right (What approach do you use in your CSS)?

Some websites use a DIV with a relative position, and then apply an absolute position to the child element to place the element at the desired position (for example, left 0 or right 0). Others use float, for example float: left or float right. Which one is better? or in what situations are they better?

Since I use fixed layouts, am I better off using relative positioning and relative positioning?

+3
source share
2 answers

I am sure that the experience of using absolute positioning works well on elements that you 100% control in terms of size; like logo, imaginary, rss links and the like. Then you can place these elements exactly where you want.

I prefer to use float when I display dynamic content on the page, as the size of the element can change, and the location of all elements in the relationship works very well with floats. Just remember to clean the floats when necessary!

+5
source

Using a DIV with a relative position, and then they apply an absolute position to the child, this is a kind of trick where there is no floating. The decision is yours with whom to go. But with great experience, you will find out which option to go with.

, - css fb , . , . .

0

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


All Articles