2016-09-21 79 views
0

在我的应用我有一个具有tr像下面对齐TD向右

<tr> 
    <td><strong>Item Total:</strong></td> 
    <td><strong style = "float:right">₹975.00</strong></td> 
</tr> 

我想移近第一td我的第二个TD的表。当我使用像margin-left:20px;这样的css时,它对我来说是个诀窍,但它也会移动我的其他trtd。我不想发生。

我的其他tr就像下面

<tr> 
    <td class="item-image"><img alt="Loose" 
    src="loose.png1466140997"> </td> 
    <td class="item-name">Loose Tea</td> 
    <td class="item-qty">1</td> 
    <td class="item-price">₹200.00</td> 
</tr> 

下面是类似fiddle

请帮忙。

+0

试试这个Item Total: deviantxdes

回答

0

试试这个

<table> 
 
    <tr> 
 
    <td class="item-image"><img alt="Loose" 
 
    src="loose.png1466140997"> </td> 
 
    <td class="item-name">Loose Tea</td> 
 
    <td class="item-qty">1</td> 
 
    <td class="item-price">₹200.00</td> 
 
    </tr> 
 
    <tr> 
 
    <td colspan="3" align="right"><strong>Item Total:</strong></td> 
 
    <td><strong style = "float:right" >₹975.00</strong></td> 
 
    </tr> 
 
</table>

0

我认为,摇椅技术已经为你正确的答案。除了HTML5以外的“align”部分。改用CSS。

HTML

<tr><td colspan="3" class="text-right"><strong>Item Total:</strong></td><td><strong style="float: right;">₹975.00</td></tr> 

CSS

.text-right { text-align: right; } 

并能有人告诉我,为什么我不能在代码段使用换行? -.-