Absolute, Relative, Fixed Positioning: How Do They Differ?

An important concept to understand first is that every single element on a web page is a block. Literally a rectangle of pixels. This is easy to understand when when you set the element to display: block; or if that element is by default display: block; This means you can set a width and a height and that element will respect that. But elements that are display: inline, like a span by default, are also rectangles, they just flow onto the page different, lining up horizontally as they can.

Now that you are picturing every single page element as a block of pixels, we can talk about how positioning is used to get the blocks of pixels exactly where you want them to go. We’re going to leave off any discussion of the box model, but that factors into this as well…

VN:F [1.9.22_1171]
Rating: -1 (from 1 vote)
Absolute, Relative, Fixed Positioning: How Do They Differ?, 7.0 out of 10 based on 1 rating

Leave a Reply

Your email address will not be published. Required fields are marked *