类在css中不起作用
我无法设置文本字段的宽度[newbie to css]类在css中不起作用,css,html,Css,Html,我无法设置文本字段的宽度[newbie to css]这是我的代码 <div data-role="fieldcontain" > <input type="text" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true"/> </div> 但这是行不通的 .ps { width:150px !important; } 我不
这是我的代码
<div data-role="fieldcontain" >
<input type="text" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true"/>
</div>
但这是行不通的
.ps
{
width:150px !important;
}
我不知道为什么,我在谷歌上搜索了很多,但没有得到答案。请帮助我。
。ui输入文本是框架中定义的内容。如果你弄乱了它,它就会更新宽度
但它会影响整个应用程序中文本框的宽度。还请记住,jQuery MObile将删除自定义样式,并在初始化时强制其样式
您可以按如下所示进行内联样式设置,以更改文本框大小,而无需修改框架
<input type="text" id="postquestion" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true" style="width:50px"/>
这是一个workign fiddle,正如您在这个fiddle上看到的,上面的操作很好:这对我来说似乎很有效,因为您可能正在使用一些javascript来干扰您的代码并删除类。看看你在Google Chrome inspector或firebug中的分数。试试div.ps{width:150px!important}我在你的问题上看到了jquery移动标签。最可能发生的情况是,jquery正在向具有宽度样式的输入标记添加更多类。。你检查小提琴了吗??如果将其包装在fieldcontain
div中,则文本框将类似于dat。阅读jQuery移动文档
<input type="text" id="postquestion" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true" style="width:50px"/>