V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zxCoder
V2EX  ›  问与答

css 怎么选择多个祖先选择器的多个后代选择器

  •  
  •   zxCoder · 2021-03-18 19:11:38 +08:00 · 605 次点击
    这是一个创建于 1148 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这两个要合起来

    querySelectorAll('#a, a,.anchor')

    querySelectorAll('#b, a,.anchor')

    2 条回复    2021-03-18 21:04:33 +08:00
    looking0truth
        1
    looking0truth  
       2021-03-18 20:57:18 +08:00
    `"h1,.header".split(",").map(q=>document.querySelectorAll(q)).reduce((a,b)=>[...a,...b])`
    imjamespond2020
        2
    imjamespond2020  
       2021-03-18 21:04:33 +08:00 via Android
    a b flat
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2903 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:23 · PVG 23:23 · LAX 08:23 · JFK 11:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.