我正在尝试使用 CSS 创建此 Logo
我想在 CSS 中重新创建的原因是我可以为每个单独的圆圈制作动画?我正在使用 Materialise Framework,这里是我第一次可怕尝试的副本。
.hero {
background-color: #7EEDE2;
height: 100vh;
margin: 0;
padding: 0;
z-index: 1;
}
.circleOne {
margin: auto;
top: 50%;
width: 200px;
height: 200px;
border-top-left-radius: 100px;
border-top-right-radius: 100px;
border-bottom-right-radius: 100px;
border-bottom-left-radius: 100px;
border: 10px solid gray;
border-bottom: 0;
}
.circleTwo {
margin: auto;
top: 50%;
width: 150px;
height: 150px;
border-top-left-radius: 100px;
border-top-right-radius: 100px;
border-bottom-right-radius: 100px;
border-bottom-left-radius: 100px;
border: 10px solid gray;
border-bottom: 0;
}
.circleThree {
margin: auto;
top: 50%;
width: 100px;
height: 100px;
border-top-left-radius: 100px;
border-top-right-radius: 100px;
border-bottom-right-radius: 100px;
border-bottom-left-radius: 100px;
border: 10px solid gray;
border-bottom: 0;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--Import Google Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<!-- Import Framework -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css">
<link rel="stylesheet" href="css/animate.css">
<!--Import Style Sheets-->
<link href="css/main.css" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>SpecterMedia</title>
</head>
<body>
<nav class="darkBlue" role="navigation">
<div class="nav-wrapper">
<a id="logo-container" href="#" class="brand-logo center">Secter<span>Media</span></a>
</div>
</nav>
<div class="row hero valign-wrapper">
<div class="col s4 offset-s4">
<div class="circleOne"><div class="circleTwo"><div class="circleThree"></div></div></div>
<h5 class="center"> Catchy Text </h5>
<div class="section center">
<a class="waves-effect waves-light btn-large hoverable">Get Your Free Quote Now</a>
</div>
</div>
</div>
<div class="row">
<div class="col s12 intro">
</div>
<!--Import jQuery-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!--Import frameworkjs-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
</body>
</html>
最佳答案
好吧,想出一个合乎逻辑的方法来完成这需要一段时间,但我相信我已经做到了。
以下生成 3 个四分之一圆。
div {
border: 5px solid blue;
border-top-color: transparent;
border-radius: 50%;
margin: 5px;
}
其中 3 个相互嵌套,边距将它们隔开。
将纯文本 S 粘贴到最里面的 div 中效果很好,除了你希望 div
元素被转换(旋转)并且没有办法阻止它被继承所以 S正在与其 parent 一起旋转。
S 有自己的元素,并被赋予绝对定位,容器被赋予对齐方式,使其居中,类似于表格单元格:
#container {
background: grey;
display: table-cell;
text-align: center;
}
h3 {
line-height: 120px;
width: 120px;
position: absolute;
margin: 0;
}
最里面的 div
是一个合适的大小,它和它的父级一起增长以伴随整个容器,所以它以 S 为中心,考虑到它是 的边距和边框60px
.
玩转它。它相对动态,但您必须做一些数学运算以确保一切都对齐。
这是 fiddle :https://jsfiddle.net/JackHasaKeyboard/k6gw9en3/1/
关于html - 3个圆圈相互嵌套CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37768080/