Home  >  Article  >  Web Front-end  >  td中文字为什不能右对齐_html/css_WEB-ITnose

td中文字为什不能右对齐_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:22:251181browse

代码如下:

<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>

想让物品名称居右,可是加了text-align:right;还是居中,截图如下:


到底是哪儿出了问题,请大家指教


回复讨论(解决方案)

 <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>

建议使用chrome 浏览器调试,查看td 是否设置其他style,
另外可以在chrome 方便修改style进行即时预览!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn