Skip to content

Instantly share code, notes, and snippets.

@aleksmiller
Last active August 29, 2015 14:07
Show Gist options
  • Save aleksmiller/8d2631c514724960b3e7 to your computer and use it in GitHub Desktop.
Save aleksmiller/8d2631c514724960b3e7 to your computer and use it in GitHub Desktop.
Centered header with left/right background
.heading {text-align: center;}
.heading:before,
.heading:after {content: "~";display: inline-block;vertical-align: middle;}
.heading:before {margin-right: 10px;}
.heading:after {margin-left: 10px;}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="heading.css">
<title></title>
</head>
<body>
<div class="heading">Title</div>
</body>
</html>
.heading
text-align: center
&:before,
&:after
content: "~"
display: inline-block
vertical-align: middle
&:before
margin-right: 10px
&:after
margin-left: 10px
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment