在自定义 Logseq 主题时遇到的一些关于 CSS 的疑问 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jaredyam
V2EX    CSS

在自定义 Logseq 主题时遇到的一些关于 CSS 的疑问

  •  
  •   jaredyam 2022-03-26 19:04:35 +08:00 2271 次点击
    这是一个创建于 1361 天前的主题,其中的信息可能已经有所发展或是发生改变。

    custom.css:

    .dark-theme, html[data-theme="dark"] { --ls-block-bullet-active-color: rgb(217, 255, 0); --ls-block-bullet-threading-width: 1px; } .block-content-wrapper { position: relative; } .bullet-container { height: 14px !important; width: 14px !important; position: relative; transform: translate(1px, -1px); } .ls-block div.items-center { position: relative; height: 26px !important; } .ls-block .ls-block>div>div.items-center::before { content: ""; left: -1px; right: 6px; top: calc(-50% + var(--ls-block-bullet-threading-width) * 0.5 - 1px); bottom: 50%; position: absolute; border-left: var(--ls-block-bullet-threading-width) solid transparent; border-bottom: var(--ls-block-bullet-threading-width) solid transparent; border-bottom-left-radius: 10px; } .ls-block .block-children>.ls-block::before { content: ""; top: -1rem; bottom: 0; border-left: var(--ls-block-bullet-threading-width) solid transparent; left: -1px; position: absolute; } .ls-block[haschild="true"]>div>.block-content-wrapper::before { pointer-events: none; content: ""; top: 12px; bottom: 0; left: -15px; position: absolute; border-left: var(--ls-block-bullet-threading-width) solid transparent; } .ls-block[haschild="true"]:focus-within>div>.block-content-wrapper::before { border-color: var(--ls-block-bullet-active-color); --ls-block-bullet-threading-width: 3px; } .ls-block .ls-block:focus-within>div>div.items-center::before { border-color: var(--ls-block-bullet-active-color); --ls-block-bullet-threading-width: 3px; } .ls-block .block-children:focus-within>.ls-block:not(:focus-within)::before { border-color: var(--ls-block-bullet-active-color); --ls-block-bullet-threading-width: 3px; } .ls-block .block-children:focus-within>.ls-block:focus-within~.ls-block::before { border-color: transparent; } 

    以上代码可以作为 Logseq 的 custom.css 自定义主题,在光标 focus-within 一个 block 时会高亮当前 block 的嵌套路径。如下图加粗绿线:

    我现在有如下疑问:

    上述代码如何从监听 focus-within 事件切换到 hover 事件时仍然奏效?有没有办法同时高亮 focus-withinhover 事件时对应的 block 路径? 从目前的尝试来看,如果直接将所有 :focus-within 替换为 :hover 后会出现:

    1. 如果没有发生 focus-within 事件,hover 事件大致可以正常工作,但是和 focus-within 下的行为不太一致
    2. focus-within 事件仍然会被监听,干扰 hover 时的行为

    有没有比较懂 CSS 又在用 Logseq 的大佬看看上面代码怎么改可以支持 hover 时高亮或者两者同时高亮[please]

    1 条回复    2022-03-26 21:59:13 +08:00
    byheaven0912
        1
    byheaven0912  
       2022-03-26 21:59:13 +08:00
    插件市场有个类似功能插件,借鉴一下?
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3207 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 33ms UTC 11:45 PVG 19:45 LAX 03:45 JFK 06:45
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86