From the course: CSS: Variables and Fluid Layouts
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add media queries to your grid system - CSS Tutorial
From the course: CSS: Variables and Fluid Layouts
Add media queries to your grid system
- [Instructor] Now that we have our prototype working in a desktop layout, let's rework this with mobile and tablet configuration. So first of all, we are going to take these styles here for column one to column four, and we'll just go on ahead and put these in a media query at media min width of, say, 768 pixels. And we'll go ahead and open up the set of curly braces. We'll close them down here after col four. Indent everybody to make it pretty, and so that's ultimately where we're going to be. So if we make our screen size over here narrower than that, what happens, we're back to that weird, everything just sort of stacks on top of each other, right? We'll have no flex basis of any particular width, why? Because the only place we're currently declaring our flex basis, right here inside of this media query. So let's set up a second media query for, let's say, tablet dimensions. I'm just going to copy what I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Mark up a simple four-column grid system6m 48s
-
(Locked)
Create a starting CSS for the grid system7m 1s
-
(Locked)
Add media queries to your grid system11m 39s
-
(Locked)
Rewrite CSS to integrate calc() and custom properties7m 53s
-
(Locked)
Rewrite CSS to integrate gaps between grid cells4m 35s
-
(Locked)
Make the layout formula even more flexible9m 26s
-
(Locked)
Challenge: Media query integration1m 24s
-
(Locked)
Solution: Media query integration1m 59s
-
(Locked)
-
-