Home >Web Front-end >HTML Tutorial >Why can't td Chinese characters be right aligned_html/css_WEB-ITnose
The code is as follows:
<table style="width:100%; border-collapse:collapse; border:1px solid rgb(220,220,220);"> <tr style="height:30px; width:100%;"> <td style="width:100px; text-align:right;"> 物品名称: </td> <td style="text-align:left; width:300px;"> <input id="productName" name="productName" type="text" maxLength="30" value="${productName}" class="input_2"/> </td> </tr> </table>
<td style="width:100px; text-align:right;"> 物品名称: </td>
<td style="text-align:left; width:300px;"> <input id="productName" name="productName" type="text" maxLength="30" value="${productName}" class="input_2"/> </td>
<html><table style="width:500px; border-collapse:collapse; border:1px solid rgb(220,220,220);"> <tr style="height:30px; width:100%;"> <td style="width:200px; text-align:right;"> 物品名称: </td> <td style="text-align:left; width:300px;"> <input id="productName" name="productName" type="text" maxLength="30" value="${productName}" class="input_2"/> </td> </tr> </table></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <table style="width:100%; border-collapse:collapse; border:1px solid rgb(220,220,220);"> <tr style="height:30px; width:100%;"> <td width="100px" align="right"> 物品名称: </td> <td align="left" width="300px"> <input id="productName" name="productName" type="text" maxLength="30" value="${productName}" class="input_2"/> </td> </tr> </table></html>
<TD align=right>
Suggestion Use the chrome browser to debug and check whether TD has set other styles.
In addition, you can easily modify the style in chrome for instant preview!