CSS: Styling a link based on its href

♀尐吖头ヾ 提交于 2019-12-04 06:52:08

问题


I have a 3rd party link on my website which I want to style. but it don't have any class or id which I can target. Only thing it have is its unique href value. Is it possible to style a anchor tag based on its href value.


回答1:


You can use href css selector to style a tag based on link:

a[href="your url here"]{
    background:red;
}

Demo




回答2:


You can use css attribute selector like:

a[href="http://google.com"]{
   your css code here ...
}

More information here.

Thanks.



来源:https://stackoverflow.com/questions/29331831/css-styling-a-link-based-on-its-href

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!