Skip to content

Instantly share code, notes, and snippets.

@arthurattwell
Created October 13, 2016 10:07
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 arthurattwell/e5c790bd076966b00f39a29586a20d37 to your computer and use it in GitHub Desktop.
Save arthurattwell/e5c790bd076966b00f39a29586a20d37 to your computer and use it in GitHub Desktop.
Sass mixin to control text underline (designed for use with PrinceXML)
@mixin underlined($thickness,$start-position,$end-position,$vertical-position) {
display: inline-block;
position: relative;
&:after {
content: "";
position: absolute;
display: inline-block;
left: $start-position; // 0 is flush with start of text
right: $end-position; // 0 is flush with end of text
bottom: $vertical-position; // Positive units move underline closer to text, negative units further away
border-bottom: $thickness solid; // Will inherit font color
z-index: -1; // Underline falls beneath the text
}
}
// // Example usage:
// .underlined {
// @include underlined(0.02em,0.4em,0,0.3em);
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment