0

我无法设置我的文本字段的宽度 [newbie to css]
这是我的代码

<div data-role="fieldcontain" >
<input type="text" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true"/>
</div>

这是有效的

.ui-input-text{
    width:150px !important;
}

但这不起作用

.ps
{
width:150px !important;
}

我不知道为什么,我用谷歌搜索了很多,但我没有得到答案。请帮我。

4

1 回答 1

0

.ui-input-text是框架中定义的。如果你弄乱了它,那么它会更新宽度。

但它会影响整个应用程序中文本框的宽度。还要记住 jQuery MObile 将删除自定义样式并在初始化时强制它的样式。

您可以执行如下内联样式来更改文本框大小而无需破解框架。

<input type="text" id="postquestion" name="postquestion" class="ps" value="" placeholder="What's Your Question..?"data-mini="true" style="width:50px"/>

这是一个工作小提琴http://jsfiddle.net/UyFWM/

于 2013-03-07T06:34:56.110 回答