How do I position elements to be aligned on the right edge of the window?
You can float them right like so:
float: right;
That depends on the elements around it but that would be the easiest way for sure.
Note that this won't work for ABSOLUTELY positioned items obviously. See this link for a lot more details: http://www.w3schools.com/css/pr_class_float.asp
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.
You can also use Absolutely Positioned elements
div{
position:absolute;
z-index:1000;
width:20px;
height:20px;
top:0;
right:0;
}
This will pin the div to the right, top corner of the page. I use 1000
for z-index because it allows you to shim other z-indexes below it without having to alter this style.
If you want it pinned in the sense that it stays on the right of the viewport, even as you scroll the page, then you need to use fixed positioning, like this:
.pinned {
position: fixed;
right: 0;
top: 0;
width: 50px;
height: 50px;
}
Obviously change the top/width/height values to suit your purpose.