jquery-ui - css3.0 - 内容属性

标签 jquery-ui css

我写了一个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*) 应该显示在文本框的末尾,但它却显示在开头,就像这样。

enter image description here

最佳答案

从您的 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/

相关文章:

html - CSS 两列布局打破了第一列的最后一个 div

javascript - 背景大小被 ngStyle Angular2 忽略

jQueryUI 自动完成 - 将搜索结果与 DOM 中的输入相邻放置

javascript - jQuery UI 可靠吗?

jQuery + CSS - 第 4 个 div 在第 3 个 div 下,将 3 个 div 包装在一行中,第 4 个 - 在下一行

html - CSS 中嵌套列表项的双重悬停效果

jQuery UI-Slider 没有 'live' 效果和 CSS 样式

javascript - Jquery UI - 可调整大小 : alsoResize not accurate?

javascript - 始终在 jQuery 自动完成中显示一个字符串,即使它与输入字符串不匹配

JQuery Mobile UI DatePicker 定义日期格式