如何在CSS中使用属性值

问题描述 投票:0回答:1

看那里:

<style>
    a[target="_blank"]{
        color: red;
    }
</style>
<a target="_blank">Im Red</a>
<br>
<a>Im Normal</a>

它是正确的,但我可以拥有属性值吗?

喜欢此:

<style>
    *[colorAttrib]{
        color:/* value of colorAttrib */;
    }
</style>

<p colorAttrib="red">I Want To Be Red</p>
<p colorAttrib="blue">I Want To Be Blue</p>

<< FIRST段落是REDSECOND段落是BLUE

html css css-selectors attributes selector
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.