What is the difference between position: absolute; and position: fixed; in terms of the reference point for positioning?
- Relative to the initial containing block
- Relative to the nearest positioned ancestor
- Relative to the nearest positioned element
- Relative to the viewport
In CSS, position: absolute; positions an element relative to its nearest positioned ancestor, while position: fixed; positions it relative to the viewport. Understanding this distinction is crucial for precise layout control in web development.
Loading...
Related Quiz
- ________ is a CSS property that controls the presentation of underlines, overlines, and line-throughs applied to text.
- How can media queries be used to apply styles based on device features other than screen size?
- The ________ property can be used to specify an image as the list item marker in an unordered list.
- How can you create a gradient that appears as stripes with equal width using CSS?
- In SASS/SCSS, the ________ directive allows for the creation of reusable chunks of CSS.