Illustrations by
Workshop Details
Straw poll
Who has used ... for layout before?
tables!
floats
[2] from css-tricks.com
floats
floats
display:table
display:inline-block
display:inline-block
display:inline-block
But!
display:inline-block
flexbox
flexbox
https://css-tricks.com/all-about-floats/
flexbox
Defined using the display property.
.container {
display: flex;
}
This makes all of its direct children elements flex. Now you can control those elements in a variety of ways.
Flexbox lets you fill the available space. By default flex items height fill their container (equalised heights). They do what we have be achieving with floats and inline-block but are designed to to it.
one / multi dimensional layouts
one / multi dimensional layouts
one / multi dimensional layouts
one / multi dimensional layouts
one / multi dimensional layouts
This multi dimensional layout could be constructed by creating three different grids and nesting them (floats, inline-block or flexbox)
CSS grid
CSS grid
CSS grid
CSS grid
.grid {
display: grid;
grid-template-columns: auto 0.5em auto;
grid-template-rows: auto 0.5em auto 0.5em auto;
}
CSS grid
.grid nav {
grid-column: 1 / 2;
grid-row: 1 / 4;
/* grid-column: 1 / span 1 */
/* grid-row: 1 / span 3 */
}
CSS grid
.grid header {
grid-column: 3 / 4;
grid-row: 1 / 2;
/* grid-column: 3 / span 1; */
/* grid-row: 1 / span 1; */
}
CSS grid
.grid aside {
grid-column: 1 / 2;
grid-row: 5 / 6;
}
CSS grid
.grid article {
grid-column: 3 / 4;
grid-row: 3 / 6;
}
CSS grid
other ways to layout grids:-
http://gridbyexample.com by Rachel Andrew is an excellent resource for exploring all the other properties and possibilities of grids.
Tasks!
Clone this repo.
https://github.com/CodeHubOrg/css-layout
30 or 40 minute practical part, play with some examples complete some tasks. If you don't have a laptop try to work in pairs or groups with someone that does.
Text
Any questions?