CSS absolute and relative

up:: CSS

Summary

absolute always the sets the boundaries to the first thing that has relative on it. If none can be found, it sets it to the window size.

Absolute

  • takes things out of the flow of the document
  • by default it stays where it is but is out of the flow
  • it’s not even bound to the parent
  • specifying to coordinates can also set the size of the div
  • all of this is relative to the body (0px away from the top of the window)

Relative

  • on the parent (or grandparent)
  • sets the boundaries of the relative child to to the parent object