Web Structure

Web Structure

New

Intro to HTML & CSS

Intro to HTML & CSS

New

3:38

HTML Structure

HTML Structure

New

1:55

The Box Model

The Box Model

New

1:54

Responsive Design

Responsive Design

New

Intro to Responsive Design

Intro to Responsive Design

New

2:21

CSS Layout

CSS Layout

New

Intro to Web Layout

Intro to Web Layout

New

2:27

Intro to Flexbox

Intro to Flexbox

New

2:27

Grid layouts overview

Grid layouts overview

New

4:18

Width & Height Units

Width & Height Units

New

3:59

Positioning Overview

Positioning Overview

New

1:48

Intro to 3D

Intro to 3D

New

2:25

Images & Colors

Images & Colors

New

Image Resolution

Image Resolution

New

3:28

Image File Types (GIF, PNG, SVG, JPEG)

Image File Types (GIF, PNG, SVG, JPEG)

New

2:22

Color values (HEX, RGBA, color names)

Color values (HEX, RGBA, color names)

New

3:22

Dynamic Content

Dynamic Content

New

Intro to Dynamic Content

Intro to Dynamic Content

New

1:36

SEO

SEO

New

Intro to Paid vs. Organic Search

Intro to Paid vs. Organic Search

New

1:34

Intro to 301 Redirects

Intro to 301 Redirects

New

2:39

new course
CSS grid landing page tutorial (36min)

Lesson info

Lesson info

Explore this project

Want to dig into the project featured in this video and see how everything is put together? We've included the full project we used when making this lesson, and we've shared the link right under this very paragraph.

View and clone this projectDownload lesson assets
Clone this projectDownload project assets

Transcript

An element's Position can be set in a number of ways. This is really helpful when we're creating designs that require overlapping elements, or even elements that are persistently Positioned on the viewport, regardless of your scroll Position.

We'll talk about these four: Auto (or Static), Relative, Absolute, and Fixed. This is a quick crash course on these four.

Let's do Auto. This is what we generally refer to as the "normal document flow." (Elements stacking and wrapping like we'd expect in a Word document).

But for now, let's do Relative Positioning. Three images side-by-side. Three paragraphs underneath. The second image, with Relative Positioning we can move this left and right to partially overlap the other images. And what's cool about Relative Positioning is it doesn't interrupt or mess with the normal document flow. It leaves a seat warmer in its place. Its spot is held and moving it isn't messing with other content.

Let's do this with the paragraphs. Same thing with Relative Positioning here. We can overlap other content without affecting the normal document flow.

Let's do Absolute Positioning. Same setup as Relative here. But when we set this element to Absolute? It's completely removed from the document flow. Yanked out. In this case, the image's parent element has its Position set to Relative, which means our Absolutely-Positioned image is Positioned around that parent element.

And finally, let's cover Fixed. Fixed elements are Positioned around the viewport; not their parent element. That means we can scroll down the page and the Fixed elements stay Fixed — they stay where they are Relative to the viewport.

So, auto (or Static) Positioning respects the normal document flow. Relative Positioning lets us move our elements around without messing with the document flow. Absolute Position positions content around its parent element. And Fixed Position positions content Relative to the viewport, persistently holding something where it is regardless of scrolling.