Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I replace text with CSS?

Tags:

text

css

replace

How can I replace text with CSS using a method like this:

.pvw-title img[src*="IKON.img"] { visibility:hidden; } 

Instead of ( img[src*="IKON.img"] ), I need to use something that can replace text instead.

I have to use [ ] to get it to work.

<div class="pvw-title">Facts</div>

I need to replace "Facts".

like image 634
MokiTa Avatar asked Oct 25 '11 21:10

MokiTa


People also ask

How do you replace words with CSS?

To start with, we wrap the text and assign it a class. This method requires very little markup. The text “Old Text” needs to be hidden first and a new text has to be positioned exactly where the old text was. To do so, we change the visibility of this text using CSS to hidden first.

Can you change text via CSS?

You can replace text through CSS. Let's replace a green button that has the word 'hello' with a red button that has the word 'goodbye', using CSS. Note: We explicitly need to mark this as a block element, 'after' elements are inline by default.


1 Answers

Or maybe you could wrap 'Facts' round a <span> as follows:

.pvw-title span {   display: none; } .pvw-title:after {   content: 'whatever it is you want to add'; }
<div class="pvw-title"><span>Facts</span></div>
like image 172
Matthew Cachia Avatar answered Oct 03 '22 09:10

Matthew Cachia