From the course: Mastering Web Developer Interview Code

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Explain the difference between absolute and relative positioning

Explain the difference between absolute and relative positioning

From the course: Mastering Web Developer Interview Code

Explain the difference between absolute and relative positioning

- [Instructor] One of the most important properties that page elements can have is the position property. It's useful for controlling how elements appear in relationship to other elements. And they're pretty easy to understand, however, the absolute and fixed positions can be a little bit tricky. So it's a good idea to ask somebody the difference between them. Now the position property is particularly useful for creating things like tooltips, and we'll take a look at an example of that in a few minutes. Now, the key thing to remember is that it helps you control how elements affect the flow of content within a page. And there are four main position properties available. The default position is called static, and the other ones are relative, absolute, and fixed. Now there's an experimental property called sticky that allows the content to stick to the page as it is scrolled, but it barely has any browser support as of…

Contents