Key Concepts

Review core concepts you need to learn to master this subject

CSS display property

.container1 { display: block; } .container2 { display: inline; } .container3 { display: inline-block; }

The CSS display property determines the type of render block for an element. The most common values for this property are block, inline, and inline-block.

Block-level elements take up the full width of their container with line breaks before and after, and can have their height and width manually adjusted.

Inline elements take up as little space as possible, flow horizontally, and cannot have their width or height manually adjusted.

Inline-block elements can appear next to each other, and can have their width and height manually adjusted.

Display and Positioning
Lesson 1 of 1
  1. 1
    A browser will render the elements of an HTML document that has no CSS from left to right, top to bottom, in the same order as they exist in the document. This is called the flow of elements in H…
  2. 2
    Take a look at the block-level elements in the image below: Diagram of block-level elements Bloc…
  3. 3
    One way to modify the default position of an element is by setting its position property to relative. This value allows you to position an element relative to its default static position on the …
  4. 4
    Another way of modifying the position of an element is by setting its position to absolute. When an element’s position is set to absolute, all other elements on the page will ignore the element an…
  5. 5
    When an element’s position is set to absolute, as in the last exercise, the element will scroll with the rest of the document when a user scrolls. We can fix an element to a specific position on…
  6. 6
    Since static and relative positioned elements stay in the normal flow of the document, when a user scrolls the page (or parent element) these elements will scroll too. And since fixed and absolute …
  7. 7
    When boxes on a web page have a combination of different positions, the boxes (and therefore, their content) can overlap with each other, making the content difficult to read or consume. .blue-box…
  8. 8
    Every HTML element has a default display value that dictates if it can share horizontal space with other elements. Some elements fill the entire browser from left to right regardless of the size of…
  9. 9
    Some elements are not displayed in the same line as the content around them. These are called block-level elements. These elements fill the entire width of the page by default, but their width pr…
  10. 10
    The third value for the display property is inline-block. Inline-block display combines features of both inline and block elements. Inline-block elements can appear next to each other and we can sp…
  11. 11
    So far, you’ve learned how to specify the exact position of an element using offset properties. If you’re simply interested in moving an element as far left or as far right as possible in the conta…
  12. 12
    The float property can also be used to float multiple elements at once. However, when multiple floated elements have different heights, it can affect their layout on the page. Specifically, element…
  13. 13
    Great job! In this lesson, you learned how to control the positioning of elements on a web page. Let’s review what you’ve learned so far: * The position property allows you to specify the positio…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo