CSS Laid Out

Phil Nash

CSS Laid Out

Hello

Who am I?

I am not a designer

CSS Laid Out

Tables

Modern CSS layout methods

Floats

All we really wanted to do with floats was have our text flow around images. Probably images of cats, since we're on the Internet. This cat, for example, is pretty fat. He looks lazy too, but he doesn't care. Being a cat is a good life if you can get it. Purrrrfect.

Modern CSS layout methods

Floats

Demo

Tables

display:table

display:table

display:table;
display:table-row;
display:table-cell;

Demo

Issues

Further reading

Everything you know about CSS is wrong — Rachel Andrew

Flexbox

Flexbox

.container{
	display:flex;
}
	

Flexbox

.container{
	display:flex;
	flex-direction:row / row-reverse /
				   column / column-reverse;
}
	

Flexbox

.container{
	display:flex;
	justify-content: flex-start / flex-end / center /
					 space-around / space-between;
}
	

Flexbox

.container{
	display:flex;
	align-items: flex-start / flex-end / center /
					 baseline / stretch;
}

	

Demo

Further reading

Grids

Grids

.container{
	display:grid;
	grid-columns: 3fr 1fr;
}
	

Grids

.container{
	display:grid;
	grid-columns: (3fr 1fr)[11] 3fr;
}

	

Grids

.grid-element{
	grid-column:1;
	grid-row:1;
	grid-column-span:5;
	grid-row-span: 3;
}

	

Demo

Issues

Use it now?

Of course! Windows 8 apps!

Further reading

Giving Content Priority with CSS3 Grid Layout — Rachel Andrew

What to do?

Thank you

Image credits

Questions?