Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - Sibling selector not working in android?

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?

like image 979
John Avatar asked Mar 04 '13 00:03

John


People also ask

How do I select a sibling element in CSS?

Adjacent Sibling Selector (+) The adjacent sibling selector is used to select an element that is directly after another specific element. Sibling elements must have the same parent element, and "adjacent" means "immediately following".

What is sibling CSS?

The general sibling combinator ( ~ ) separates two selectors and matches all iterations of the second element, that are following the first element (though not necessarily immediately), and are children of the same parent element.

Which selector selects adjacent siblings?

The CSS adjacent sibling selector is used to select the adjacent sibling of an element. It is used to select only those elements which immediately follow the first selector.

What is the difference between adjacent sibling selector and general sibling selector?

The adjacent sibling selector is different from the general sibling selector as it selects only the element that immediately follows an element, whereas the general sibling selector selects any element that follows an element.


1 Answers

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

The sibling selector is supported

the :checked pseudo-class is not

like image 60
ElefantPhace Avatar answered Oct 18 '22 07:10

ElefantPhace