A Pen by DriftwoodJP on CodePen.
Last active
August 29, 2015 14:10
-
-
Save DriftwoodJP/c11c897c9cceadb635f9 to your computer and use it in GitHub Desktop.
CSS Overlaying a Horizontal Line
This file contains hidden or 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
%h1.horizontal | |
%span Lorem ipsum dolor | |
%p.horizontal--left | |
%span Lorem ipsum dolor. |
This file contains hidden or 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
@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