使用CSS,是否可以右對齊兩個DIV?右對齊兩個div
我有一個標題,我想右對齊它下面的更多鏈接。該網站是內部的,不幸的是,IE7是主要的瀏覽器。 (我們將在年底之前升級到IE8,有些使用Chrome)。我想避免使用JavaScript,但我願意接受。
標題發生變化,所以絕對寬度不起作用。它應該是這個樣子:
| Arbitrarily long title text
| more...
我一直都在谷歌尋找一個解決方案,但一切到目前爲止,我發現涉及到右aliging一個DIV的內容,或右鍵將DIV與頁面對齊,或在絕對大小的DIV內對齊DIV。
到目前爲止,我可以向您展示我的努力,但由於它們都不起作用,所以我認爲它們沒有多大用處。
<html>
<body>
<div style="float:left;">
Arbitrarily long title
<div style="float:right">more...</div>
</div>
<div style="width:0px; overflow:visible; white-space:nowrap;">
Arbitrarily long title
<div style="float:right">more...</div>
</div>
<!-- This sort of simulates what I want, but the title length is arbitrary and I don't want to have to measure the text -->
<div style="width:120px;">
Arbitrarily long title
<div style="float:right">more...</div>
</div>
</body>
</html>
如果有人知道重複的問題,我很想知道你的Google-fu的祕密!
編輯
圖片,根據要求。該鏈接與紅色接壤。 (我不得不把利潤率左設置爲70像素,達到這個影響。)
請提供你想要做....甚至油漆製成的圖像將是非常有益的圖像 –
嗯,這是要健全天真:這有什麼錯'文本-align'? – Chris