-
-
Save kejun/c68fc83920f5e38c2aa0586b2122eac7 to your computer and use it in GitHub Desktop.
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
// pug | |
div.menu | |
ul | |
each v in [1,2,3,4,5,6,7,8] | |
li | |
a( href='#' )= v | |
// css | |
@mixin circle-layout($radius, $dot-radius, $num) { | |
$deg: 360deg / $num; | |
ul{ | |
box-sizing: border-box; | |
position: relative; | |
width: $radius * 2; | |
height: $radius * 2; | |
border: 1px solid #ccc; | |
border-radius: 50%; | |
} | |
li { | |
box-sizing: border-box; | |
position: absolute; | |
width: $dot-radius * 2; | |
height: $dot-radius * 2; | |
border-radius: 50%; | |
border: 1px solid gray; | |
list-style: none; | |
line-height: $dot-radius * 2; | |
top: 0; | |
left: 50%; | |
margin: #{ -$dot-radius } 0 0 #{ -$dot-radius }; | |
transform-origin: $dot-radius #{ $radius + $dot-radius }; | |
& > a { | |
display: block; | |
width: 100%; | |
height:100%; | |
text-align: center; | |
} | |
} | |
@for $i from 1 through $num { | |
li:nth-child(#{$i}) { | |
transform: rotate($deg * $i); | |
a { | |
transform: rotate(-$deg * $i); | |
} | |
} | |
} | |
} | |
body { | |
display: flex; | |
justify-content: center; | |
} | |
@include circle-layout(100px, 20px, 8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment