Open Playground
CSS TutorialLesson #71

CSS Position Offsets

The `top`, `right`, `bottom`, and `left` properties are used to position elements.

Positioning with top, right, bottom, and left

The top, right, bottom, and left properties are used to position elements.

These properties only work on positioned elements (elements with position set to relative, absolute, fixed, or sticky).


Positioning Text On an Image

How to position text on an image:

Example

<img src="img_5terre_wide.jpg" alt="Cinque Terre" style="width:100%;height:auto;opacity:0.5"> Bottom Left Top Left Top Right Bottom Right Centered

Try it Yourself:


All CSS Positioning Properties

PropertyDescription
bottomSets the bottom margin edge for a positioned box
clipClips an absolutely positioned element
leftSets the left margin edge for a positioned box
positionSpecifies the type of positioning for an element
rightSets the right margin edge for a positioned box
topSets the top margin edge for a positioned box