我有一個簡單的表格單元格,其中包含一個文本和一個圖標。我想對齊左側的文本和右側的圖標。我試過這樣,但它不起作用。我知道的唯一解決方案是創建另一個td
,我在裏面放置圖標。但我想這兩個,在一個td
將表格單元格右側的圖標對齊?
table {
border: 1px solid red;
}
td {
border: 1px solid black;
width: 200px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<table>
<tr>
<td>Text <span align="right"><i class="fa fa-toggle-on"></i></span></td>
<td>Test</td>
</tr>
</table>
建議您刪除'ALIGN =「權「'因爲html元素的align屬性已被棄用:w3.org/TR/html401/present/graphics.html#adef-align – webeno