Question about the relevance of margins or display properties for absolutely positioned or fixed positioned elements
If absolutely positioned or fixed positioned elements are taken out of the normal flow, is it still advisable to use margins to position those elements
or
would it be just the same if th开发者_如何学运维e [ top, right, bottom, left] position properties are used instead to move the elements around?
I would say it's not advisable.
The properties - top
, right
, bottom
, left
- exist to position such styled elements accordingly. Using margin
, although may work, would not be the correct positioning property and could lead to undefined behavior.
With that said, there are obviously more than one way to do things in CSS. So in the end, it's up to you.
精彩评论