eric
eric

Reputation: 3

How to use CSS to replace text?

How do I replace Type: with Class: using CSS?

<span class="skills">Type:<a href="....../type/aaa/">aaa</a>, <a href="...../type/bbb/">bbb</a></span>

Upvotes: 0

Views: 105

Answers (2)

Jaswinder Kaur
Jaswinder Kaur

Reputation: 1634

.skills{font-size:0;}
.skills a{font-size:20px;}
.skills a:after {content: ", "; font-size: 20px;}
.skills a:last-child:after {content: ""; } 
.skills:before {
content: 'Class: ';
font-size:20px;
}
<span class="skills">Type:<a href="....../type/aaa/">aaa</a>, <a href="...../type/bbb/">bbb</a></span>

Upvotes: 0

Ravi Makwana
Ravi Makwana

Reputation: 2914

It's was challenging without updating HTML here's code
It's not perfect but it's works :D

.skills:before {
  content: "Class: ";
  font-size: 14px;

}

.skills {
  font-size: 0;
}
 
.skills a {
  font-size: 14px;
}

.skills a:after {
  content: ", ";
  font-size: 14px;
}
 
<span class="skills">Type:<a href="....../type/aaa/">aaa</a>, <a href="...../type/bbb/">bbb</a></span>

Upvotes: 2

Related Questions