Customize css link as url

Posted on

Question :

I’ve seen somewhere that has a way to apply a particular css to a ” a ” if you have a particular text in the link, but I can not find it anymore.

For example, I have the following links in my html

<a href="http://site.com.br/nothing">Link para nada</a>
<a href="http://site.com.br/something"><Link para alguma coisa</a>
<a href="http://other.com.br/something"><Link para alguma coisa</a>

Assuming that only the link that has something in href has a different style, how could you do that?

    

Answer :

use for example

a[href="http://site.com.br/something"]{
    font-size: 30px;
}

To consider only one part of the url, just use a * soon after href

a[href*="something"]{
    font-size: 30px;
}

    

Using this selector.

a[href="http://site.com.br/nothing"] {
  color: red;
}

Reference .

    

Leave a Reply

Your email address will not be published. Required fields are marked *