一直在優化一些使用精靈的東西,並遇到了這個問題......我需要兩個塊對齊到文本的右側,但不管我做了什麼,他們開始左對齊在它下面的新行。使用position:absolute似乎可以在我的編輯器中工作,但是在發佈時不會。需要將兩個塊對齊在文本的右側 - 可能嗎?
<!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>
你可以發佈一個鏈接到你的網站上的現場演示(顯示相關圖片),或者[JS小提琴演示](http://jsfiddle.net/)? – 2011-05-20 22:23:52