Sometimes, we want to relatively position an element without it taking up space in document flow with CSS.
In this article, we’ll look at how to relatively position an element without it taking up space in document flow with CSS.
How to relatively position an element without it taking up space in document flow with CSS?
To relatively position an element without it taking up space in document flow with CSS, we change the margin.
For instance, we write
.box {
position: relative;
top: -30px;
margin-bottom: -30px;
}
to offset the top value with the margin-bottom value to stop the elements with class box
from taking up space in the document flow.
Conclusion
To relatively position an element without it taking up space in document flow with CSS, we change the margin.