From the course: CSS Layouts: From Float to Flexbox and Grid
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
The box model properties - CSS Tutorial
From the course: CSS Layouts: From Float to Flexbox and Grid
The box model properties
- [Instructor] Now that we've talked a bit about the normal flow, let's talk about how these elements interact with each other. Every element is viewed by the browser as a rectangular box. The CSS Box Model describes how these boxes are generated for each HTML element. There are five properties that can be used to define the Box Model. Width is used to set the width of the content area, which contains the actual content added between the tags. Height sets the height of the content area. Padding adds or removes the space within an element. Margin adds or removes a space around the element. And border is added between padding and margin. Let's look at how these properties are applied to block and inline elements. Block elements are the same height as the content contained between their tags, but they span the entire width of their containing element, even if the content itself doesn't. This is why block elements always start…
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
-
-
-
-
Inline and block elements1m 53s
-
The box model properties3m 32s
-
The display property5m
-
The box model and layouts3m 17s
-
The float property3m 19s
-
Clearing floats5m 46s
-
Setting up your project3m 8s
-
Exercise: Build a layout with float9m 54s
-
Position: Relative and absolute5m 15s
-
Position: Fixed, sticky, and static4m 31s
-
-
-
-