position

Manipulate the exact position of your HTML elements. The Top and Left attributes define where the object will be placed.

  • Move Left - Use a negative value for left.
  • Move Right - Use a positive value for left.
  • Move Up - Use a negative value for top.
  • Move Down - Use a positive value for top.

Value Description
absolute Absolute positioning defines the position in terms of distance from the top left of the window. Positive x values will move it right. Positive y values will move it down. Negative values will move it in the opposite direction.
relative Relative positioning changes the position of the element relative to its original location. Positive x values will move it right. Positive y values will move it down. Negative values will move it in the opposite direction.
percentage The width of this element will be a percentage of the element it is inside of.
size px - size in terms of pixels
em - size in terms of the current font size
in - size in terms of inches
cm - size in terms of centimeters

Code:

h3 {
position: relative;
top: 15px;
left: 150px;}

p {
position: absolute;
left: 0px;}

Display: