Skip to content

Instantly share code, notes, and snippets.

@hotmeteor
Created March 31, 2014 15:21
Show Gist options
  • Save hotmeteor/9894793 to your computer and use it in GitHub Desktop.
Save hotmeteor/9894793 to your computer and use it in GitHub Desktop.
Text replacer for smaller screens.
@media only screen and (max-width: 599px) {
[data-replace] {
display: inline-block;
overflow: hidden;
letter-spacing: -999em;
vertical-align: bottom;
&::before {
content: attr(data-replace);
letter-spacing: 0;
}
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0">
<link rel="stylesheet" href="data-replace.css">
</head>
<body>
<div class="container">
<p>I like S<span data-replace=".">yntactically</span> A<span data-replace=".">wesome</span> S<span data-replace=".">tyle</span> S<span data-replace=".">heets</span>.</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment