trbaphong trbaphong - 1 year ago 91
CSS Question

Float right and position absolute doesn't work together

I want a div to be always at the right of its parent div, so I use

. It works.

But I also want it to not affect other content when inserted, so I use

doesn't work, my div is always at the left of its parent div. How can I move it to the right?

Answer Source


position:absolute; right: 0;

No need for float:right with absolute positioning

Also, make sure the parent element is set to position:relative;

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