Skip to content

Instantly share code, notes, and snippets.

@DriftwoodJP
Last active August 29, 2015 14:10
Show Gist options
  • Save DriftwoodJP/c11c897c9cceadb635f9 to your computer and use it in GitHub Desktop.
Save DriftwoodJP/c11c897c9cceadb635f9 to your computer and use it in GitHub Desktop.
CSS Overlaying a Horizontal Line
%h1.horizontal
%span Lorem ipsum dolor
%p.horizontal--left
%span Lorem ipsum dolor.
@import "compass/css3";
@mixin overlay-hrline(
$color: #ccc,
$bg-color: #fff,
$align: center,
$padding: 0 0.5em
) {
position: relative;
text-align: $align;
&:before {
content: "";
display: block;
border-top: solid 1px $color;
// or
// background: $color;
// height: 1px;
position: absolute;
width: 100%;
top: 50%;
z-index: 1; }
span {
background: $bg-color;
padding: $padding;
position: relative;
z-index: 2; }
}
.horizontal {
@include overlay-hrline($padding: 0 1em);
}
.horizontal--left {
@include overlay-hrline($align: left);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment