尝试创建一个包含6个放射状的圆形菜单

时间:2014-03-05 10:55:45

标签: html css

我正在尝试使用html和css创建一个包含6个放射状的圆形菜单。我只得到6个总辐射中的5个(边界)。我需要得到item5和item6之间的最后一个径向。我需要得到相同的图片:

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 }
}

1 个答案:

答案 0 :(得分:2)

我想出了一个简单的问题,让你的换行,尽管有点奇怪。

我所做的只是添加一个没有任何内容的附加项目,然后旋转它,给它一个背景并将其转换到位。

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

jsFiddle demo

你没有白色边框的原因是因为item6已被轮换,所以它与你的item1对齐,而不是被轮换,因此它创建了{{{}之间的边框1}}和item5

我尝试旋转item6所以它创建了它自己和5之间的边界,但它导致它与item1重叠,这只是为了解决它而导致一个永无止境的z-index循环