Quantcast
Channel: Hide element, but show CSS generated content - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by EoghanM for Hide element, but show CSS generated content

$
0
0

Building on @anroesti's excellent hack, here's a solution if you need to apply in unknown contexts in terms of font size and color, i.e. you are not sure if resetting to color:black;font-size:1rem; will not mess things up:

<span abbrev-content="Intl.">International</span>@media only screen and (max-width: 700px) {  /* very narrow viewports */    span[abbrev-content] { font-size: 0.001em; visibility: hidden; }    span[abbrev-content]::before {         content: attr(abbrev-content);         font-size: 1000em;         visibility: visible;     }}

If your span content is a paragraph and not just a word, you may also need the negative letter-spacing.


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>