【问题标题】:Is there a way to have URL-related CSS-Styles?有没有办法拥有与 URL 相关的 CSS 样式?
【发布时间】:2015-01-03 06:38:37
【问题描述】:

有没有办法拥有与 URL 相关的 CSS 样式?

例如。我的网页上有一个链接

<a href="#blue">Blue</a>

点击后 URL 变为 test.com#blue

是否可以根据此 URL 应用样式?

background-color: blue;

【问题讨论】:

    标签: html css url styles href


    【解决方案1】:

    the :target pseudo-class 将匹配带有id 的元素,该id 与URL 中的片段标识符匹配。

    【讨论】:

      猜你喜欢
      • 2012-09-20
      • 2010-09-15
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 2020-08-30
      • 1970-01-01
      相关资源
      最近更新 更多