Today you'll get practice with styling pages specifically for layout.
Reminder: practice using your browser's page inspection resources! You can review slides from Lab 1 if needed.
example.html
, the path to the support image assumes it is in
the same directory as the HTML file).
Sample output (click to view in full size):
Note that your browser window size will definitely affect how the page is rendered. The sample image was generated on a wide screen, so it is possible that your page will flow differently.
You can find our solution to Exercise 1 here.
Flexbox is a set of CSS properties useful for aligning block level content into various layouts.
Flexbox can help manage how the elements should be sized relative to each other.
Like the position property, you have to think about your content in terms of the elements themselves, and the containers they are in.
The most complicated thing about flexbox is that the content can "flex" in either direction: horizontally into rows, or vertically into columns.
display: flex;
justify-content: flex-end; (flex-start, space-around,...)
align-items: flex-end; (flex-start, center, baseline,...)
flex-direction: row; (column)
flex-basis: 20%; (3em, 50px,...)
align-self: flex-end; (flex-start, center, stretch,...)
There are great tutorials out in the world to help learn flexbox. This CSS-Tricks one goes into a deeper explanation of the flex properties and has some great examples to compare each - it's a great bookmark resource to reference for this class!
For the remainder of the lab, you are to work on Flexbox Froggy, which is CSS game for learning the basics of Flexbox. It's fairly self-contained, but feel free to talk to your neighbor with any questions or let your TA know if you run into anything you're not sure about along the way!