From the course: CSS Essential Training
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Creating full-height layouts
From the course: CSS Essential Training
Creating full-height layouts
- [Narrator] A common design for websites is setting an element to be relative to the height of the browser viewport. Om the final project, The header spans 100% of the viewport height, even when resized. To create this style, the height must be defined for both the HTML and body elements before sizing the child elements. Let's look at an example. CodePen is designed for experiments and testing, so it integrates required HTML tags, like HTML and body into the tool. When you create a new pen, you don't need to add these tags, but they are still included, which means we can apply CSS styles to them. Let's start by taking a look at how height is applied to these elements by default. Right now, we have a div with a border and some padding styles. This is the element we want to size, relative to the viewport. I've also added the CSS for the box sizing property. So the border and padding styles won't affect the overall…
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)
Introduction to the CSS box model1m 4s
-
(Locked)
Width, height, and display3m 7s
-
(Locked)
Padding, margin, and border4m 59s
-
(Locked)
Center-aligning with margin3m 7s
-
(Locked)
Box-sizing and the box model fix3m 31s
-
(Locked)
Working with developer tools5m 1s
-
(Locked)
Margin collapse and inline spacing2m 48s
-
(Locked)
Creating full-height layouts3m 2s
-
(Locked)
Project: List reset and header updates4m 51s
-
(Locked)
Project: Centering content with margin5m 49s
-
(Locked)
Project: Heading resets and border styles4m 4s
-
(Locked)
-
-
-
-
-
-