Skip to content

Instantly share code, notes, and snippets.

@gandhiShepard
Created September 1, 2014 03:48
Show Gist options
  • Save gandhiShepard/c243f17b536f23e3b488 to your computer and use it in GitHub Desktop.
Save gandhiShepard/c243f17b536f23e3b488 to your computer and use it in GitHub Desktop.
Centering Elements From http://codepen.io/terrymun/pen/HhEqc
@import url(http://fonts.googleapis.com/css?family=PT+Sans:400,700);
$sans-serifs: "Helvetica Neue", Helvetica, Arial, sans-serif;
.pseudo {
content: '';
display: block;
position: absolute;
}
body {
color: #333;
line-height: 1.5em;
padding-top: 2em;
font-family: "PT Sans", $sans-serifs;
}
header {
padding: 0 8.33333%;
h1 {
padding-bottom: 1em;
margin-bottom: 1em;
letter-spacing: 5px;
position: relative;
text-align: center;
text-transform: uppercase;
&::after {
@extend .pseudo;
border-bottom: 1px solid #ccc;
bottom: 0;
left: 37.5%;
width: 25%;
}
&::before {
@extend .pseudo;
background-color: #fff;
content: '</>';
color: #ccc;
display: inline-block;
font-weight: normal;
font-size: .5em;
letter-spacing: 2px;
line-height: 1em;
padding: 0 .25em;
left: 50%;
bottom: -.5em;
text-align: center;
transform: translateX(-50%);
z-index: 2;
}
}
}
section {
div {
margin: 0 auto;
padding: 2em 0;
width: 66.66666%;
&.block span {
display: block;
text-align: center;
}
&.inline-block span {
background-color: #1A7B30;
display: inline-block;
position: relative;
left: 50%;
transform: translateX(-50%);
}
&.inline span {
display: inline;
}
}
span {
background-color: #0076A3;
border: none;
border-radius: 1.5em;
color: #eee;
font-size: .8em;
letter-spacing: 2px;
line-height: 3em;
padding: 0 2em;
text-transform: uppercase;
}
p {
margin: 1em 0 0 0;
}
.inline p {
margin: 0;
}
.break {
margin: 0 8.33333%;
width: 83.33333%;
p {
}
}
code {
background-color: #eee;
padding: 0 .5em;
color: #333;
}
pre {
background-color: #eee;
padding: 1em;
code {
background: none;
padding: 0;
font-size: .8em;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment