Style HTML element based on its title using CSS

前端 未结 5 1752
慢半拍i
慢半拍i 2021-01-08 01:33

Is it possible to apply a style to an HTML element using only its title as a unique identifier? For example:


      
5条回答
  •  太阳男子
    2021-01-08 02:13

    CSS specifications identify a number of "selectors" that may help you here. For example, you could apply a rule such as the following:

    .my_class a[title="MyTitle"]
    {
       ...
    }
    

    You can see a detailed specification of CSS "selectors" here:

    http://www.w3.org/TR/2001/CR-css3-selectors-20011113/

提交回复
热议问题