Been optimizing some stuff using sprites and ran into this problem… I need the two blocks to be aligned to the right of the text, but no matter what I do they start left aligned on a new line underneath it. Using position:absolute appears to work in my editor, but when publishing it does not.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<style type="text/css">
a.facebook{margin:0 5px 0 0;float:left;display:block;width:30px;height:30px;background:url(social.png) no-repeat 0 0;background-position:0px -38px;overflow:hidden;text-indent:-10000px;font-size:0px;line-height:0px;}
a.twitter{margin:0 5px 0 0;float:left;display:block;width:30px;height:30px;background:url(social.png) no-repeat 0 0;background-position:-30px -38px;overflow:hidden;text-indent:-10000px;font-size:0px;line-height:0px;}
</style>
</head>
<body>
<div>this is a test
<a href="#" onclick="window.open('http://test.com')" title="Find us on Facebook!" class="facebook">Find us on Facebook!</a>
<a href="#" onclick="window.open('http://test.com')" title="Find us on Twitter!" class="twitter">Find us on Twitter</a></div>
</body>
</html>
If I got the question, I think you’re looking for
float:right, but notice that floats float relatively to the elements that follow them, so you need to place the links before the text.edit: more data
If you want blocks to be inserted into other elements as if they were part of the text, you should make their
display:inline-block(in IE6 this only works for elements that are inline by default). But then they’ll appear in the position they’re inserted into, not floating.