Skip to content

Instantly share code, notes, and snippets.

@dotnetCarpenter
Last active September 27, 2016 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotnetCarpenter/fc227f305b001d7235abcc644b9bfc64 to your computer and use it in GitHub Desktop.
Save dotnetCarpenter/fc227f305b001d7235abcc644b9bfc64 to your computer and use it in GitHub Desktop.
Minimum required to set an underline that can be animated
/**
* Minimum required to set an underline that can be animated
*/
.f-jons-demo1 h2 {
display: inline; /* an inline element only takes up the size of its content (the content is "Hello World") */
color: darkred;/* not needed - set the color of the text */
background: linear-gradient(grey, grey) bottom / 100% .1em no-repeat;
}
/* The above can also be written like this: */
.f-jons-demo1 h2 {
display: inline;
color: darkred;/* not needed - set the color of the text */
background-color: linear-gradient(grey, grey);
background-position: bottom;
background-repeat: no-repeat;
background-size: 100% 0.1em;
}
/* Minimum required to set an underline */
.f-jons-demo2 h2 {
color: darkred;/* not needed - set the color of the text */
text-decoration: grey underline;/* no control over how thick the line is */
}
<div class="f-jons-demo1"> <h2>Hello World</h2> <p> Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text. </p> <p> Text and text Text and text Text and text Text and text. </p></div>
<div class="f-jons-demo2"> <h2>Hello World</h2> <p> Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text Text and text. </p> <p> Text and text Text and text Text and text Text and text. </p></div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"90","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment