gpt4 book ai didi

css - 选择

转载 作者:行者123 更新时间:2023-11-28 09:39:39 26 4
gpt4 key购买 nike

我有两种类型的标签,像第一行这样的普通标签,以及其中包含输入字段的标签。什么CSS规则可以让我全选<label>但排除所有恰好包含 <input> 的标签在?

<label for="type">Some Label</label>

<label for="type">
<input type="checkbox" value="1" id="type">Some Label
</label>

最佳答案

这样做的最佳方法是向它们或至少向其中一个添加不同的类。

CSS 没有父选择器,因此您无法使用我们的一些 javascript 检查包含其他元素的元素。

一些背景:
CSS selector for "foo that contains bar"?
Is there a CSS parent selector?
CSS Parent/Ancestor Selector
Complex CSS selector for parent of active child

关于css - 选择 <label> 但排除包含 &lt;input&gt; 的 <label>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11280050/

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