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".
This isn't really possible without tricks. Here is a way that works by replacing the text with an image of text.
This type of thing is typically done with Javascript. Here is how it can be done with jQuery:
You can't, well, you can.
This will insert content after the current content of the element. It doesn't actually replace it, but you can choose for an empty div, and use CSS to add all the content.
But while you more or less can, you shouldn't. Actual content should be put in the document. The content property is mainly intended for small markup, like quotation marks around text that should appear quoted.
I use this trick:
I've even used this to handle internationalization of pages by just changing a base class...
Try using: before and: after. One inserts text after HTML is rendered, the other inserts before HTML is rendered. If you want to replace text, leave button content empty.
This example sets the button text according to the size of the screen width.
Button text:
1) with :before
big screenxxx
big screen
2) with :after
xxxbig screen
big screen
Obligatory: This is a hack: CSS isn't the right place to do this, but in some situations - eg, you have a third party library in an iframe that can only be customized by CSS - this kind of hack is the only option.
You can replace text through CSS. Let's replace a green button with 'hello' with a red button that says 'goodbye', using CSS. See http://jsfiddle.net/ZBj2m/274/ for a live demo:
Here's our green button:
Now let's hide the original element, but add another block element afterwards:
Note:
visibility
. Notedisplay: none
on the original element doesn't work.Based on mikemaccana’s answer, this worked for me
§ Absolute positioning