gpt4 book ai didi

CSS - 在类中设置多个 id

转载 作者:太空宇宙 更新时间:2023-11-03 23:34:17 26 4
gpt4 key购买 nike

我想让这段 CSS 代码起作用:

#inventoryGarbageSpot .id1,.id2,id3,id4{
padding:0px;
padding-top: 0px;
width:35px;}

如果我写一个 id 而不是多个 id,它就可以工作。

谢谢你的帮助,

轮回

最佳答案

如果我们分解您的选择器,您的目标是:

  • #inventoryGarbageSpot .id1
  • .id2
  • id3
  • id4

首先,有2个不存在的元素:id3id4,代表这种元素:

<id3></id3>
<id4></id4>

其次,您需要在每节课前重复您的#inventoryGarbageSpot

不要使用这个无效的选择器,使用这个:

#inventoryGarbageSpot .id1,
#inventoryGarbageSpot .id2,
#inventoryGarbageSpot .id3,
#inventoryGarbageSpot .id4 {
padding:0px;
padding-top: 0px;
width:35px;
}

如果你想泛化你的选择器,你可以使用属性选择器,正如 Sudharsan 所提到的。

关于CSS - 在类中设置多个 id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24530987/

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