a video guide to CSS Positioning properties

Select any property below and we’ll show you step-by-step how to use the property, with video demo, tips and practical examples you can code for yourself.

position

top, bottom, left & right

z-index

FAQs

about CSS text and font properties.

What is CSS positioning?

CSS positioning is a technique used in CSS to place and arrange HTML elements in a particular position on a web page.

What are the different types of CSS positioning?

The different types of CSS positioning are static, relative, absolute, fixed, and sticky.

What is the difference between static and relative positioning?

position:static is the default position of an element, where it appears in the normal flow of the page. position:relative allows you to move the element from its original position without affecting other elements on the page.

What is the difference between relative and absolute positioning?

position:relative positions the element relative to its original position, while position:absolute positions the element relative to the nearest non-static ancestor.

What is fixed positioning?

positioning:fixed positions the element relative to the browser window, so it remains in the same position even when the user scrolls the page.

What is sticky positioning?

position:sticky is a type of positioning where the element behaves like it's relatively positioned until a certain scroll point, and then it becomes similar to position:fixed.

What are the properties used in positioning?

positioning:fixed positions the element relative to the browser window, so it remains in the same position even when the user scrolls the page.

What are the directional properties used in positioning?

The properties used in positioning are top, bottom, left, right, and z-index.

What do the directional properties (top, right, bottom and left) do in CSS positioning?

The directional properties specifies the distance between the directional edge of the positioned element and the top edge of its refrence point. This is from its original location for position:relative;, from its nonstatic parent for absolute.

What does the z-index property do in CSS positioning?

The z-index property specifies the stack order of the positioned element, which determines which element appears in front of the other elements on the page. A higher z-index value means the element appears in front of elements with lower z-index values.

Copyright 2023