Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pin elements on the right?

Tags:

css

How do I position elements to be aligned on the right edge of the window?

like image 783
john2x Avatar asked May 28 '10 15:05

john2x


People also ask

How do you place an element to the right?

If position: absolute; or position: fixed; - the right property sets the right edge of an element to a unit to the right of the right edge of its nearest positioned ancestor. If position: relative; - the right property sets the right edge of an element to a unit to the left/right of its normal position.

How do you make a div stick to the right side?

if a div is fixed or absolute you can use right: 0; to get the div to the right.

How do you keep elements on the same line?

To get all elements to appear on one line the easiest way is to: Set white-space property to nowrap on a parent element; Have display: inline-block set on all child elements.


1 Answers

If you want to remove the element from the flow,

position: absolute;
right: 0;
top: /* whatever */;

but it's hard to answer your question with the "right" answer without more detail/context.

like image 75
Matt Ball Avatar answered Oct 04 '22 00:10

Matt Ball