是否可以在CSS中选择具有特定内容或属性的元素? [英] is it possible to select element with specific content or attribute in CSS?

查看:114
本文介绍了是否可以在CSS中选择具有特定内容或属性的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以选择具有特定内容的元素?



例如在 #footer 我不能使用 #footer> a {}



只能选择< a> if #footer has < a herf =#header>页首< / a> ,但不是全部< a>

解决方案



如果我正确理解你的选择器会是这样的

  a [href =yourlink] 

这将在页脚中选择一个特定的链接,在href属性中有yourlink
这是你想要的吗?


Is it possible to select element with specific content?

for example in #footer i have multiple so i can't use #footer > a {}

can i select only that <a> if #footer has <a herf="#header">Top of Page</a>, but not all <a>

Is there any cross-browser way to select like this?

解决方案

If I understand you correctly, your selector would be something like this

a[href="yourlink"]

This will select one specific link in your footer that has "yourlink" in the href attribute Is this what you want?

这篇关于是否可以在CSS中选择具有特定内容或属性的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆