CSS - Sibling selector not working in android?

丶灬走出姿态 提交于 2019-12-01 03:48:30

问题


This code works fine in Chrome on desktop, but not android stock browser:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
input:checked ~ span {color:red;}
</style>
</head>
<body>
<label>
<input type="checkbox" />
<span>First item</span>
</label>
</body>
</html>

Basically when you click hte check mark, the span tag text should turn red. It's not turning red on my Galaxy Note with android 4.0.

What's wrong with my code?


回答1:


http://quirksmode.org/css/selectors/mobile.html

The sibling selector is supported

the :checked pseudo-class is not



来源:https://stackoverflow.com/questions/15192674/css-sibling-selector-not-working-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!