zxCoder
V2EX  ›  问与答

请教一个 css 问题

  •  
  •   zxCoder · Nov 7, 2021 · 1420 views
    This topic created in 1828 days ago, the information mentioned may be changed or developed.

    有一个 input ,然后前面有一个 icon ,css 能实现,input focus 的时候,icon 的样式也修改吗

    2 replies  •  2021-11-07 20:31:58 +08:00
    xell
    xell
    Nov 7, 2021❤️1
    1
    + 或者 ~ 选择器就好了,例如

    <input type="text" id="text"><icon class="icon">

    #text:focus ~ .icon { ... }
    iNaru
    iNaru
    Nov 7, 2021❤️1
    2
    参考 :focus-within
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   926 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:34 · PVG 05:34 · LAX 13:34 · JFK 16:34
    ♥ Do have faith in what you're doing.