我知道,您可以通過將左右邊距設置爲auto
來居中塊項目。如何將塊項目與其父項的右邊緣(使用CSS)對齊?
但是,是否可以將它對齊到右邊?這將如何完成?
編輯:不使用float: right
(因爲它似乎並沒有工作,至少不是<ul>
的)
再次編輯:這裏是代碼片段:
<td style='vertical-align: top; text-align: center;'>
<b>Choices:</b><br><br>
<ul id='orderchoices' style='margin-left: auto; margin-right: auto;'>
...
</ul>
</td>
這裏是#orderchoices
#orderchoices li {
border: 1px solid #666;
background: #333 url(images/dark_gloss.png) repeat-x;
color: #eee;
margin: 3px;
padding: 5px;
cursor: pointer;
width: 160px;
font-style: italic;
}
風格我想ul
右ALIG在td
你說的「的意思似乎不工作「?容器沒有正確封裝內容? –
我的意思是它保持左對齊。 –