Static, Relative, Absolute, and Fixed: What's the Difference?

Though the fundamental concept of 'HTML (Content) + CSS (Presentation) = Webpages seems simple at a high-level, when you actually experiment and delve into the intricacies of both HTML and CSS, you quickly realize the criticality of understanding the 'Why' of things. For example, when trying to space an image on the page, sometimes I haphazardly fuddle through adding margins and paddings -almost in a trial-and-error process - until I'm feeling satisfied or too frustrated, whichever comes first.

The same issue applies for positioning elements, and as this is a fundamental and critical aspect of web design, I feel it's worth the time to take a look under the hood and really understand what is going on. This will hopefully save you some time, mental agony, and allow you to better put into fruition your creativity!

There are four main positioning attributes in CSS:

Check out the simulator at the bottom of this page for practice!

Resources: