课程: Mastering Web Developer Interview Code

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Explain the difference between absolute and relative positioning

Explain the difference between absolute and relative positioning

课程: 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…

内容