我正在使用 jquery mobile 构建我的用户界面 但问题是我无法调整标签的宽度 你能告诉我如何将我所有标签的宽度设为 108 像素吗
下面的代码
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
<label data-role="none" for="basic">Zip</label>
<input style="width: 280px;" data-role="none" type="text"
name="name" id="basic" value="">
</div>
我正在尝试为所有具有恒定宽度的标签实现类似的东西
最佳答案
您的标记中存在一些问题 - 标签的 for
属性与输入的名称不同。这会阻止 jQuery Mobile 正确设置您的内容的样式。例如,这个:
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
<label data-role="none" for="basic">Phone</label>
<input style="width: 280px;" data-role="none" type="text" name="name" id="basic" value="" />
</div>
应更改为此(注意 for
和 name
属性现在匹配):
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
<label data-role="none" for="basic">Phone</label>
<input style="width: 280px;" data-role="none" type="text" name="basic" id="basic" value="" />
</div>
完成此操作后,jQuery Mobile 应该可以让您的表单以您想要的方式工作。
关于html - jQuery Mobile 中的标签宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14330568/