Decabol
Decabol

Reputation: 11

Changing colors of signs in a page with HTML5 and CSS

I have links in my website. And I want them to look like the following when I create a new one.

I'm going to buy a [Nintendo Switch] later this year.

The paragraph text is black, link text is blue and brackets text is red.

How can I do this?

Upvotes: 1

Views: 37

Answers (1)

Sebastian Brosch
Sebastian Brosch

Reputation: 43594

You can use the following solution using :before and :after pseudo-element:

a, a:link {
  color:blue;
}
a.w-brackets:before {
  content:'[';
  color:red;
}
a.w-brackets:after {
  content:']';
  color:red;
}
I'm going to buy a <a class="w-brackets" href="http://www.nintendo.com/switch/">Nintendo Switch</a> later this year.

Upvotes: 2

Related Questions