freeCodeCamp's Change an Element's Relative Position, Applied Visual Design

Lesson Summary

In this freeCodeCamp lesson from the Applied Visual Design section we look at the setting the "position" of an element. We learn that all of our html elements are treated like a box by CSS and there are such things as block level elements and inline. Block level elements will always start on a new line while inline elements dont have to start on a new line. Some block level elements are divs and paragraphs while some inline elements are spans or images. We then learn that there is a normal flow that everything follows and the "position" attribute allows us to give it different values. In this lesson we give the position property a value of "relative" and specify a "top" attribute which takes a value of 15px. This will move our element 15px away from the top where the normal flow would be.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required