【问题标题】:There is ORDER for HTML tag attributesHTML标签属性有ORDER
【发布时间】:2017-06-08 04:47:13
【问题描述】:
我为输入标签尝试了相同的属性,但顺序不同,布局会有所不同。我认为标签的属性没有顺序,你能解释一下吗?
顺便说一下,类字段如下:
.field {
font-family: "MS UI Gothic";
font-size: 12px;
height: 17px;
border: 1px solid #ADD566;
readonly: false;
}
输入1标签:
Input2 标签:
.field {
font-family: "MS UI Gothic";
font-size: 12px;
height: 17px;
border: 1px solid #ADD566;
readonly: false;
}
Input1 tag:
<input name="code" size="9" maxlength="6" type="text" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" class="field" value="">
Input2 tag:
<input name="code" size="9" maxlength="6" type="text" class="field" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" value="">
【问题讨论】:
标签:
html
input
attributes
tags
【解决方案1】:
课前有一个特殊字符(U+3000 : IDEOGRAPHIC SPACE),只能使用空格(U+0020 : SPACE [SP])。
你可以在这里测试它:http://www.babelstone.co.uk/Unicode/whatisit.html
您的代码:
.field {
font-family: "MS UI Gothic";
font-size: 12px;
height: 17px;
border: 1px solid #ADD566 !important;
readonly: false;
}
Input1 tag:
<input name="code" size="9" maxlength="6" type="text" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" class="field" value="">
Input2 tag:
<input name="code" size="9" maxlength="6" type="text" class="field" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" value="">
用空格替换后:
.field {
font-family: "MS UI Gothic";
font-size: 12px;
height: 17px;
border: 1px solid #ADD566 !important;
readonly: false;
}
Input1 tag:
<input name="code" size="9" maxlength="6" type="text" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" class="field" value="">
Input2 tag:
<input name="code" size="9" maxlength="6" type="text" class="field" onChange="javascript:this.value=this.value.toUpperCase();" style="ime-mode:disabled; text-transform:uppercase" value="">