So, the word is International for example.
I would like to do something like this for mobile phones for example:
<span class="word-international">International</span>
and then style as follows for mobile phone:
.word-international{
content:"Int'l";
}
for obvious space reasons (and SEO reasons). This does not work, but I seem to remember there is some way to do this, I just cannot recall the specific HTML tag or attribute within the tag, something like <abbr> – thanks!
2
Answers
Css content property only works on :before, :after pseudo elements, it doesn’t work on the direct elements. So you could do something like this
HTML
CSS
If you are using a mobile first approach, then change the css accordingly, hope this helps
If you really need to physically change the content in the same element I can think of one way to do this. You have to create a pseudoelement for mobile devices
But I’d suggest using some js to change the content of element or even better have two elements with classes
mobile
anddesktop
and use media queries to show/hide themThis is the way it’s usually done.