Skip to content

Instantly share code, notes, and snippets.

@derekwheee
Created April 18, 2014 15:00
Show Gist options
  • Save derekwheee/11048591 to your computer and use it in GitHub Desktop.
Save derekwheee/11048591 to your computer and use it in GitHub Desktop.
Lines on Sides
// This puts a 1px line on either side of a heading
// ------- Like This -------
.lines-on-sides {
display: table;
text-align: center;
white-space: nowrap;
&:after,
&:before {
content: '';
display: table-cell;
width: 50%;
background: linear-gradient(transparent 50%, currentColor 50%, currentColor calc(50% + 1px), transparent calc(50% + 1px));
background-clip: padding;
}
&:after {
border-left: 1em solid transparent;
}
&:before {
border-right: 1em solid transparent;
}
}
@derekwheee
Copy link
Author

This adds lines on either side of your heading.

<h1 class="lines-on-sides">Your Heading</h1>

Or use @extend .lines-on-sides in Sass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment