Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Created January 19, 2018 08:48
Show Gist options
  • Save kettanaito/1ad10d60f618df31071819aa17413f93 to your computer and use it in GitHub Desktop.
Save kettanaito/1ad10d60f618df31071819aa17413f93 to your computer and use it in GitHub Desktop.
HTML: One-element crossed heading
<!--
One-element way of doing this kind of headings:
---------------- Text here ----------------
* One HTML tag only
* Background-independant
* Properly centered horizontally and vertically
* Same browsers support as for flexbox
-->
<style>
.heading {
display: flex;
align-items: center;
}
.heading:before,
.heading:after {
content: '';
flex: 1;
background-color: #ccc;
height: 1px;
}
.heading:before {
margin-right: 1rem;
}
.heading:after {
margin-left: 1rem;
}
</style>
<h3 class="heading">Lorem ipsum</h3>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment