Skip to content

Instantly share code, notes, and snippets.

@Loiree
Last active October 14, 2015 14:17
Show Gist options
  • Save Loiree/145897eacab360600d89 to your computer and use it in GitHub Desktop.
Save Loiree/145897eacab360600d89 to your computer and use it in GitHub Desktop.
Hexagon on CSS
<div class="hex">
<div class="hex-part">
<div class="hex-cont">
<p>content</p>
</div>
</div>
</div>
.hex
width 200px
height 100px
transform rotate(120deg)
position relative
overflow hidden
visibility hidden
display block
text-decoration none
.hex-part
width 100%
height 100%
transform rotate(-60deg)
overflow hidden
.hex-cont
width 100%
height 100%
background orange
transform rotate(-60deg)
text-align center
visibility visible
// Для смены вида нужно высоту и ширину поменять местами
// display block — если встраивать стили к ссылкам и другим неблочным элементам
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment