Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to create a circular menu with 6 radials

Tags:

html

css

I'm trying to create a circular menu with 6 radials using html and css. I only get 5 of the 6 total radials (borders). I need get the last radial, between item5 and item6. I need get the same of the picture:

EXAMPLE

DEMO

HTML

<div id="menu">
    <div class="item1 item">
        <div class="content"><a href="#one">Solución Aula Digital</a></div>
    </div>
    <div class="item2 item">
        <div class="content"><a href="#two">Live Streaming</a></div>
    </div>
    <div class="item3 item">
        <div class="content"><a href="#three">Social Tecal Online</a></div>
    </div>
    <div class="item4 item">
        <div class="content"><a href="#four">FlexScorn</a></div>
    </div>
    <div class="item5 item">
        <div class="content"><a href="#five">Video On Demand</a></div>
    </div>
    <div id="wrapper6">
        <div class="item6 item">
            <div class="content"><a href="#six">Video Colaboración</a></div>
        </div>
    </div>
    <div id="center">
        <a href="#"></a>
    </div>
</div>

CSS

    #menu {
    background: #aaa;
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 155px;
    -moz-border-radius: 100%;
    -webkit-border-radius: 100%;
}
#center {
    position: absolute;
    left: 60px;
    top: 60px;
    width: 180px;
    height: 180px;
    z-index: 10;
    background: #FFFFFF;
    border-radius: 100px;
    -moz-border-radius: 100px;
    -webkit-border-radius: 100px;
}
#center a {
    display: block;
    width: 100%;
    height: 100%
}
.item {
    background: #aaa;
    overflow: hidden;
    position: absolute;

    transform-origin: 100% 100%;
    -moz-transform-origin: 100% 100%;
    -webkit-transform-origin: 100% 100%;
    transition: background .5s;
    -moz-transition: background .5s;
    -webkit-transition: background .5s;
    -o-transition: background .5s;
    -ms-transition: background .5s;
    border: 3px solid #FFFFFF;
}
.item:hover {
    background: #eee
}
.item1 {
    z-index: 1;
    transform: rotate(60deg);
    -moz-transform: rotate(60deg);
    -webkit-transform: rotate(60deg);
    width: 134px;
    height: 134px;
}
.item2 {
    z-index: 2;
    transform: rotate(120deg);
    -moz-transform: rotate(120deg);
    -webkit-transform: rotate(120deg);
    width: 150px;
    height: 150px;
}
.item3 {
    z-index: 3;
    transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
            width: 150px;
    height: 150px;
}
.item4 {
    z-index: 4;
    transform: rotate(240deg);
    -moz-transform: rotate(240deg);
    -webkit-transform: rotate(240deg);
            width: 152px;
    height: 152px;
}
.item5 {
    z-index: 5;
    transform: rotate(300deg);
    -moz-transform: rotate(300deg);
    -webkit-transform: rotate(300deg);
            width: 151px;
    height: 151px;
}
.item6 {
    border: none;
    position: absolute;
    z-index: 6;
    transform: rotate(-30deg);
    -moz-transform: rotate(-30deg);
    -webkit-transform: rotate(-30deg);
    width: 140px;
    height: 140px;
}
#wrapper6 {
    position: absolute;
    width: 160px;
    height: 160px;
    overflow: hidden;
    transform-origin: 100% 100%;
    -moz-transform-origin: 100% 100%;
    -webkit-transform-origin: 100% 100%;
    /*border: 2px solid #FFFFFF;*/
}



.item1 .content {
    left: 0px;
    top: 17px;
    transform: rotate(-60deg);
    -moz-transform: rotate(-60deg);
    -webkit-transform: rotate(-60deg);
}
.item2 .content {
    left: -5px;
    top: 31px;
    transform: rotate(-59deg);
    -moz-transform: rotate(-59deg);
    -webkit-transform: rotate(-59deg);
}
.item3 .content {
    left: -40px;
    top: 8px;
    transform: rotate(-237deg);
    -moz-transform: rotate(-237deg);
    -webkit-transform: rotate(-237deg);
}
.item4 .content {
    left: -43px;
    top: 4px;
    transform: rotate(-240deg);
    -moz-transform: rotate(-240deg);
    -webkit-transform: rotate(-240deg);
}
.item5 .content {
    left: -52px;
    top: 7px;
    transform: rotate(-247deg);
    -moz-transform: rotate(-247deg);
    -webkit-transform: rotate(-247deg);
}
.item6 .content {
    left: 26px;
    top: -3px;
    transform: rotate(-29deg);
    -moz-transform: rotate(-29deg);
    -webkit-transform: rotate(-29deg);
}
.content, .content a {
    width: 100%;
    height: 100%;
    text-align: center
}
.content {
    position: absolute;
}
.content a {
    line-height: 100px;
    display: block;
    position: absolute;
    text-decoration: none;
    font-family: 'Segoe UI', Arial, Verdana, sans-serif;
    font-size: 12px;
    /*text-shadow: 1px 1px #eee;
    text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff*/
}
.display-target {
    display: none;
    text-align: center;
    opacity: 0;
}
.display-target:target {
    display: block;
    opacity: 1;
    animation: fade-in 1s;
    -moz-animation: fade-in 1s;
    -webkit-animation: fade-in 1s;
    -o-animation: fade-in 1s;
    -ms-animation: fade-in 1s;
}
@keyframes fade-in {
    from { opacity: 0 }
    to { opacity: 1 }
}
@-moz-keyframes fade-in {
    from { opacity: 0 }
    to { opacity: 1 }
}
@-webkit-keyframes fade-in {
    from { opacity: 0 }
    to { opacity: 1 }
}
@-o-keyframes fade-in {
    from { opacity: 0 }
    to { opacity: 1 }
}
@-ms-keyframes fade-in {
    from { opacity: 0 }
    to { opacity: 1 }
}
like image 948
jarab Avatar asked Mar 05 '14 10:03

jarab


People also ask

How do you use a radial menu?

To use the radial menu, hold down the L button. From there you'll have the option to switch between four loadouts by pressing any of the four directions on the D-pad while still holding down the L button. Each loadout contains eight different shortcuts.

Where is radial menu?

With the standard keyboard bindings on PC, the radial menu is opened by holding space. This Menu is used in various ways.


1 Answers

I figured out a simple problem to get your line break in, albeit it is a little odd.

All I did was add an additional item without any content and then rotated it, gave it a background and transformed it into place.

transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
width: 1px;
height: 70px;
left: 68px;
top: 81px;

jsFiddle demo

The reason why you didn't have a white border there is because your item6 was rotated so it lined up with your item1, instead of it being rotated so it created the border between item5 and item6.

I tried rotating item6 so it created the border between itself and 5, but it caused it to overlap with item1, which just caused a never ending z-index loop in order to solve it

like image 160
Ian Ryan Clarke Avatar answered Sep 21 '22 05:09

Ian Ryan Clarke