html - css3中的多个完美环/圆

标签 html css

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 8 年前

我想用 CSS3 重新创建这个标志。 Logo 的环都需要单独点击/难以处理。我该怎么做?

enter image description here

最佳答案

Here's a fiddle.

你可以摆脱的包装,它只是为了帮助在那个小窗口内显示它。 您必须自己找到正确的字体。

LINK(虽然不是很准确)

<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200italic' rel='stylesheet' type='text/css'>

CSS:

    .wrapper {
        position:absolute;
        top:50%;
        left:50%;
        margin: 40px;

        }           
        div {
            border-radius: 50%;
            position: relative;
            text-align: center;
            background: #fff;
            display: inline-block;
        }

        .four {
            height: 510px;
            width: 510px;
            border: 17px solid rgb(120,245,63);
            border-top-color: #fff;
            transform: rotate(-135deg);
            margin: -315px 0 0 -315px;
            position: absolute;
            top:50%;
            left:50%;
            }

        .three {
            height: 450px;
            width: 450px;
            border: 17px solid rgb(62,170,245);
            border-top-color: #fff;
            transform: rotate(180deg);
            margin: -242px 0 0 -242px;
            position: absolute;
            top:50%;
            left:50%;    
            }
        .two {
            height: 370px;
            width: 370px;
            border: 17px solid rgb(238,31,122);
            border-top-color: #fff;
            transform: rotate(180deg);
            margin: -202px 0 0 -202px;
            position: absolute;
            top:50%;
            left:50%;  
            }
        .one {
            height: 240px;
            width: 240px;
            border: 17px solid rgb(255,147,30);
            border-top-color: #fff;
            transform: rotate(180deg);
            margin: -137px 0 0 -137px;
            position: absolute;
            top:50%;
            left:50%;
            }

        .logo {
            height: 75px;
            width: 75px;
            margin: -50px 0 0 -50px;
            position: absolute;
            top:50%;
            left:50%;
            transform: rotate(-45deg);
            font-family: 'Source Sans Pro', sans-serif;
            font-size: 72px;
            font-style: italic;
        }

    sup {
        font-size: 16px;
        position: relative;
        bottom: 15px;
    }

HTML:

<div class="wrapper">
    <div class="four" onclick="clickMe(this)">
        <div class="three" onclick="clickMe(this)">
            <div class="two" onclick="clickMe(this)">
                <div class="one" onclick="clickMe(this)">
                    <div class="logo">MG<sup>24</sup></div>
                </div>
            </div>
        </div>
    </div>
</div>

编辑
根据@arifix 的要求。
要使圆环可单独点击,请将其添加到您的代码中,并确保将 onClick 事件监听器添加到您的圆环中。

JavaScript:

    function clickMe(element)
    {
       if (!e) var e = window.event;
        e.cancelBubble = true;
        if (e.stopPropagation) e.stopPropagation();

        // Do what you want with class
        elementClass = element.className;
        console.log(elementClass);
    }

关于html - css3中的多个完美环/圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25220076/

上一篇:jquery - Slicknav 菜单的定位

下一篇:javascript - 运行javascript修改css

相关文章:

javascript - 启用浏览器滚动条工作

javascript - AngularJS ng-repeat-start ng-repeat-end with table 和 rowspan

javascript - 移除悬停动画

javascript - 如果屏幕低于 480 像素,则阻止 Javascript 继续执行某个功能

html - 是否可以使用 Rollup 创建一个从模板注入(inject) HTML 的包?

javascript - 作为汽车配置器控制复杂的 Sprite 图像

javascript - HTML 中的地址函数

javascript - 在页面(哈希)链接中,获取第一个可见元素

css - 组合宽度和最大宽度

javascript - 这是如何工作的 : http://welbog. homeip.net/