Home >Web Front-end >HTML Tutorial >Why can't td Chinese characters be right aligned_html/css_WEB-ITnose

Why can't td Chinese characters be right aligned_html/css_WEB-ITnose

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

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>

Among them,
<td style="width:100px; text-align:right;">						物品名称:					</td>

I want the item name to be on the right, but I added text-align:right; it is still centered. The screenshot is as follows:


What is the problem? Please tell me


Reply to the discussion (solution)

 <td style="text-align:left; width:300px;">                        <input id="productName" name="productName" type="text" maxLength="30" value="${productName}" class="input_2"/>                    </td>



This It’s on the right



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

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