Chapsterj Chapsterj - 2 years ago 66
HTML Question

position relative and right property

I always thought by setting the div to relative and right 0 would position the div all the way to the right, if its parent was 100% width. Apparently I'm wrong and only absolute works like that. So is there no way to make it work with relative?

Answer Source

You have to set the parent to be relative, and it's child to absolute positioning.

  position: relative;
  width: 100%;
  position: absolute;
  width: 200px;
  height: 200px;
  background: red;

‚Äč Like here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download