Relative Position

One of the options for adjusting the position is setting the position property to relative. This allows us to offset the element from its initial position without affecting other elements.

  • We can offset:
  • Left (left)
  • Right (right)
  • Top (top)
  • Bottom (bottom)

Instructions

Create a rule for the element with id square2 (#square2), where you set the position property to relative.

Notice that the element is in the same position.

Offset it from the left by 10 pixels.

Notice that the offset did not affect the position of the third element, which remains in the same place.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

6/10