jQuery Mobile的 - 设置文本框背景 [英] Jquery Mobile - set textbox background
问题描述
我想设置背景颜色 jQuery Mobile的
文本字段,但是背景并不覆盖整个文本框。如可以在下方的左和控制的右端图像中看到有未继承的背景色部分。
I'm trying to set background color the JQuery Mobile
textbox field, however the background is not covering the whole textbox. As you can see in the image below on the left and the right ends of the control there are parts that are not inheriting the background color.
问题
问题是, jQuery Mobile的
动态加入一些 DIV
包装和文本框呈现像
The problem is that JQuery Mobile
is adding dynamically some div
wrappers and the textbox is rendered like that
<div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c">
<input type="text" name="name" class="inputreq ui-input-text ui-body-c" id="name" value="">
</div>
如果我设置背景颜色的 DIV
包装,将覆盖整个文本框,但我怎么能做到这一点的纯 CSS
?有没有一种方法来设置元素的父的风格?
If I set the background color to the div
wrapper it will cover the whole textbox, but how can I do this with pure CSS
? Is there a way to set the style of an element's parent?
下面是一个工作的jsfiddle 上面的例子。有一个勇敢的战士JQM能帮助我吗?
Here is a working jsfiddle with the example above. Is there a brave JQM warrior that could help me?
推荐答案
使用
.ui-shadow-inset, ui-corner-all, ui-btn-shadow, ui-body-c
{
background-color: #D5EEFF !important;
}
如果这个覆盖其他一些组件,删除这个奖项CSS。
If this override some other component, remove the award this CSS.
更新
$(".inputreq").parent().css("background-color", "#D5EEFF");
这篇关于jQuery Mobile的 - 设置文本框背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!