gpt4 book ai didi

css - Internet Explorer中的相邻同级组合器(+)问题

转载 作者:行者123 更新时间:2023-12-04 21:26:42 25 4
gpt4 key购买 nike

我在CSS中使用相邻的同级组合器(+)。它似乎仅适用于Firefox,不适用于Internet Explorer。
以下是令人反感的代码段。

    .mycheckbox:checked + label {
// Do something to the label when the checkbox is checked
}

最佳答案

回应您的编辑:

IE8不支持:checked。它可以在IE9中使用。

http://reference.sitepoint.com/css/pseudoclass-checked



旧答案:

唯一可能的原因是您的页面位于Quirks Mode中。

添加一个有效的doctype作为触发标准模式的第一行,相邻的同级组合器将在该模式下工作。

<!DOCTYPE html>

关于css - Internet Explorer中的相邻同级组合器(+)问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6693554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com