Sometimes we want to nudge an element out of its natural position within the document flow. Let's do this in two steps:
position
property for the special heading so that it stays within the document flow, but can be moved based on that starting position.2rem
down from its top edge.Hint: Make sure your properties are in alphabetical order.
What is the best definition of document flow?
This time, let's completely remove an element from the document flow and place it somewhere on the page. Let's do this in two steps:
position
property for the special heading so that it is removed from the document flow and can be positioned with regard to the page as a canvas. It should still move when the page scrolls.Hint: Make sure your properties are in alphabetical order.
True or False: The top
, right
, bottom
, and left
properties can only be used in combination with the position
property.
And now we'll try something a little more complex and position an element so that it stays in place as the page scrolls beneath it. Again, we'll do this in two steps:
position
property for the navigation so that it is removed from the document flow and can be positioned with regard to the viewport window as a canvas. It should remain in place when the page scrolls.Hint: Make sure your properties are in alphabetical order.
It's nice that the navigation stays at the bottom as the user scrolls, but we can probably make it look a little nicer. Add the CSS to make the navigation extend the whole width of the bottom of the window, from the left edge to the right edge.
There are multiple ways to achieve this, but you should use the technique most closely tied to the position
property and its related properties
Hint: Make sure your properties are in alphabetical order.
By default, absolutely positioned elements use the whole page as their canvas for placement. That's what's happening to the star in the code below. But sometimes we want to place the element absolutely with reference to a specific parent or ancestor as the canvas.
Add the CSS code to make the "card" div behave as the placement canvas for the absolutely positioned star. The star should end up in the upper-right corner of the card.
Hint: Make sure your properties are in alphabetical order.