CSS TutorialLesson 24Free preview
CSS Position Offsets
This lesson is part of CSS · All levels
Summary
Once an element is made relative, absolute, or fixed, the distance can be adjusted by the offset properties: top, right, bottom, and left. These four properties determine the distance of the element from its side of the equation. The value may be px, %, em, brake, even auto, and may be negative to shift past the normal limit.
Key points
- Top, right, bottom, and left determine the distance of the element from its side of the equation.
- The absolute element measures the offset against the nearest non-static parent padding box.
- Offset can be negative to shift elements out of the normal range.
- On the fixed element, the offset is calculated against the viewport.
- Adjusting two opposite sides at once, like left and right, can stretch the width of an absolute element.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.