CSS Title Between Lines ('-' * 24) Less mixin to CSS Title Between Lines decoration, minimal markup
Created
May 17, 2015 00:10
-
-
Save emiliorizzo/01ab7066f3eedcf730b0 to your computer and use it in GitHub Desktop.
CSS Title Between Lines
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
<div class="deco"> | |
<h1 class="tit">This is my title</h1> | |
</div> | |
<div class="deco2"> | |
<h1 class="tit">This is my title</h1> | |
</div> | |
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 "lesshat"; | |
.deco{ | |
font-size:5em; | |
font-family: 'Arial', sans-serif; | |
.title-mixin(); | |
} | |
.deco2{ | |
font-size:100px; | |
font-family: "Times New Roman", Times, serif; | |
.title-mixin(); | |
} | |
// | |
// Title Mixin | |
// @fs: font size | |
// | |
.title-mixin(){ | |
display: table; | |
position: relative; | |
margin:1em 0; | |
&:before , &:after{ | |
border-width: 1px 0; | |
border-style: solid; | |
content: ""; | |
height: 1.2em; | |
display: block; | |
width: 45%; | |
position: absolute; | |
} | |
&:after{ | |
right: 0px; | |
top: 0px; | |
} | |
&:before{ | |
left: 0px; | |
} | |
.tit{ | |
font-size: 0.8em; | |
margin: auto; | |
height:100%; | |
display: inline-block; | |
vertical-align: middle; | |
&:before, &:after{ | |
content: "*"; | |
font-size:0.6em; | |
position: absolute; | |
text-align: center; | |
width: 100%; | |
display:block; | |
margin: 0; | |
padding: 0; | |
} | |
&:before{ | |
top:-0.5em; | |
} | |
&:after{ | |
bottom: -0.9em; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment