Last active
August 29, 2015 14:03
-
-
Save alkrauss48/c995f6c4154c69a4ecfb to your computer and use it in GitHub Desktop.
Highlighting Text Around Each Character
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This entire file is optional. May be useful if using with a CMS where your users are | |
// entering in paragraphs, and you always want to highlight their paragraph text by default | |
$('p').wrapInner('<span class="highlight"></span>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
span.highlight { | |
background-color: rgba(0, 0, 0, .5); | |
box-shadow: 0.2em 0 0 rgba(0, 0, 0, .5),-0.2em 0 0 rgba(0, 0, 0, .5); | |
-moz-box-shadow: 0.2em 0 0 rgba(0, 0, 0, .5),-0.2em 0 0 rgba(0, 0, 0, .5); | |
-webkit-box-shadow: 0.3em 0 0 rgba(0, 0, 0, .5),-0.3em 0 0 rgba(0, 0, 0, .5); | |
} | |
/* | |
Optional: This gives IE8 translucent background support, but adds 2 translucent layers in IE9. | |
Does not affect IE10+. Your call. | |
*/ | |
p { | |
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#80000000,endColorstr=#80000000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<span class="highlight"> | |
Let's assume this text is multiline. | |
Each line will highlight exactly to the end of the line, | |
and not like a big block | |
</span> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment