【问题标题】:How to change the color of an link element/objects on a website with CSS ?如何使用 CSS 更改网站上链接元素/对象的颜色?
【发布时间】:2014-11-25 06:17:01
【问题描述】:

网址是 www.thebusslab.com/research.html

如果您转到任何页面并找到对 pdf 的链接或引用,则文本将显示为绿色。我将如何使用 CSS 更改颜色?提前致谢!

【问题讨论】:

    标签: html css pdf colors hyperlink


    【解决方案1】:

    你像这样改变锚标签的颜色。

    a {
        color: green;
    }
    

    您可以尝试只定位这样的 pdf 链接。这将针对所有具有以.pdf 结尾的href 属性的锚标记。

    a[href$='.pdf'] {
        color: green;
    }
    

    【讨论】:

      【解决方案2】:

      在你的 main.css 文件中有一条规则:

      a {
      text-decoration: none;
      color: #8BC53F;
      }
      

      驱动这个。将颜色十六进制设置为您喜欢的任何颜色。

      【讨论】:

        【解决方案3】:

        所有类型的链接(正常,访问,...)都需要样式:

        a, a:visited, a:hover, a:active, a:link {
          text-decoration: none;
          color: #000000;
        }
        

        【讨论】:

          【解决方案4】:

          这是在您的文件 main.css 中设置的

          a {
              color: #8bc53f;
              text-decoration: none;
          }
          

          您可以在此处了解样式链接 http://www.w3schools.com/css/css_link.asp

          【讨论】:

          • 这是我需要知道的,谢谢!
          【解决方案5】:
          <html>
          <head>
              <style> 
                  a[href$='.html'] {
                      color: green;
                  }
              </style>
          </head>
          <body>
              <a href="test.html">This is some text in a paragraph.</a>
          </body>
          

          【讨论】:

          • 运行这段代码,你就会知道怎么做。
          • 虽然这篇纯代码帖子可能会回答这个问题,但请添加解释为什么会这样。
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-06-10
          • 1970-01-01
          • 2016-03-14
          • 2013-02-13
          • 2016-06-04
          • 2013-11-29
          相关资源
          最近更新 更多