简体   繁体   English

这个CSS选择器是什么?

[英]What is with this css selector?

I'm having a custom styled checkboxes with image insead of the dom element. 我有一个自定义样式的复选框,其中包含dom元素的图像。 It's using this selector. 它正在使用此选择器。 What this selector do? 这个选择器做什么? +em is bugging me big time :) + em烦我很多时间:)

input[type='checkbox']:checked+em::before

Please help. 请帮忙。

The + is an adjacent sibling combinator . +相邻的同级组合器 So that selector selects the em element immediately following a checked checkbox. 因此,选择器会在选中复选框之后立即选择em元素。 This is as distinct from the general sibling combinator , ~ , which would match any following sibling of the input even if not right next to it. 这与一般的同级组合器 ~截然不同,后者将匹配input任何后续同级,即使不是紧邻它。

创建一个伪元素,该元素是em标记的第一个子元素,该元素位于具有选中的属性类型复选框的输入元素之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM