CSS: Display & Positioning

Learn how to control the display and positioning of elements using CSS.

Display Property

The display property determines how an element is displayed:

Position Property

The position property specifies the positioning method for an element:

Example: Display & Positioning

/* Example */
div {
    display: block;
    position: relative;
    top: 20px;
    left: 10px;
}
        

This example positions a div element relative to its normal position.

Practice

Try experimenting with display and positioning properties:

Continue Learning

Quick Check

Which position value fixes an element relative to the viewport?