代码之家  ›  专栏  ›  技术社区  ›  I am the Most Stupid Person

是否可以使用href link显示None?

  •  1
  • I am the Most Stupid Person  · 技术社区  · 7 年前
    <a href="example.html">Any text or Image<a>
    

    我想使用href的值添加display none。

    display: none example.html . 所有其他锚定标签应仍然可见。

    换言之,我只想隐藏链接去 示例.html .

    这可能吗?

    4 回复  |  直到 7 年前
        1
  •  6
  •   Sebastian Brosch Navjyot    7 年前

    您可以使用以下解决方案,使用 attribute selector :

    a[href="example.html"] {
      display:none;
    }
    <a href="example.html">Any text or Image<a>
    <a href="https://stackoverflow.com/">StackOverflow<a>

    你也可以使用 a[href$="example.html"] 如果 href

    a[href$="example.html"] {
      display:none;
    }
    <a href="example.html">Any text or Image<a>
    <a href="https://example.com/example.html">Any text or Image<a>
    <a href="https://stackoverflow.com/">StackOverflow<a>
        2
  •  0
  •   Sarabjit Singh    7 年前

    a[href="example.html"]{display:none !important;}
        3
  •  0
  •   Navneet Kumar    7 年前
    [href="'example.html'"]{display: none;}
    

    这将隐藏所有具有“example.html”值的锚定标记。

        4
  •  0
  •   bogdanpetru    7 年前

    你可以使用 attribute selector

    [href="example.html"] {
      display: none;
    }
    
    推荐文章