Created
January 19, 2018 08:48
-
-
Save kettanaito/1ad10d60f618df31071819aa17413f93 to your computer and use it in GitHub Desktop.
HTML: One-element crossed heading
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
<!-- | |
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