android - android jelly Bean WebView 中的背景图像位置问题

标签 android html css webview

背景图像位置在 Jelly Bean webView 中不呈现,但在 KitKat 版本中工作正常

CSS

    .clearable{
      background:url("../images/txtclear.png") no-repeat right 5px center !important;  
      border:1px solid #999;
      padding:3px 18px 3px 4px; 
      border-radius:3px; 
      transition: background 0.4s; 
    }

HTML

<html>
<body>
<input value="" id="txtsearch" type="email" placeholder="Enter Search string" class="clearable"/>
</body>
</html>

我也引用了以下 URL 中的类似帖子,但这不能解决我的问题。 background-attachment messes up rendering in Jelly Bean WebView?

最佳答案

具有四值语法的

background-position 仅在 Android 4.4 及更高版本中受支持,这就是它无法正确呈现的原因。

http://caniuse.com/#feat=css-background-offsets

对于那些版本,您可以使用后备规则以正确显示。只需调整 % 或 px 以匹配您的元素宽度和高度。

.clearable{
   background-position: 95% 50%; /* Will apply only for < 4.4 */
   background-position: right 5px center;
}

希望这对您有所帮助!

问候

关于android - android jelly Bean WebView 中的背景图像位置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23925426/

相关文章:

android - 在 Fragment 类中更改方向时保留数据

android - 如何从 Android 应用程序共享文本和链接到 Messenger?

html - Rails - 在表单中输入 html 时关闭 html 标签

javascript - DOM 父元素与父节点

html变换旋转90度与div

javascript - 在javascript中匹配css规则

html - 在视频上叠加文字

android - 屏幕旋转后无法 popBackStack()。安卓导航组件

android - 谷歌分析推荐人 Activity

javascript - 如何通过js设置可见帖子?