我写了一个css文件
.atleastTwoChars:after {
content: "2*";
float: left;
width: 16px;
height: 14px;
border: 0;
margin: 2px 3px 0px 3px;
color: red;
}
我是这样用的
<nobr>
<input type="hidden"
name="ctl00$objContentPageTag$spzContactInformation$txt_sContactZipCode$objHidden"
id="ctl00_objContentPageTag_spzContactInformation_txt_sContactZipCode_objHidden" value="0">
<input name="ctl00$objContentPageTag$spzContactInformation$txt_sContactZipCode$objTextBox"
type="text"
id="ctl00_objContentPageTag_spzContactInformation_txt_sContactZipCode_objTextBox"
class="xqh_LookUpTextBox_Edit">
<span id="ctl00_objContentPageTag_spzContactInformation_txt_sContactZipCode_spanImgMandatory"
class="atleastTwoChars">
</span>
</nobr>
JavaScript:
$('#ctl00_objContentPageTag_spzContactInformation_txt_sContactZipCode_spanImgMandatory')
.removeClass("xqh_LookUpTextBox_ImgMandatory")
.addClass("atleastTwoChars");
$('img[id*="txt_sContactZipCode_imgMandatory"]').remove();
问题:content (2*) 应该显示在文本框的末尾,但它却显示在开头,就像这样。
最佳答案
从您的 CSS 中删除 float: right;
:JS Fiddle demo .
顺便说一下,根据 W3,nobr
:
[...is] entirely obsolete, and must not be used by authors...
引用:
关于jquery-ui - css3.0 - 内容属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8555349/