css3實現的太極圖程式碼例項

admin發表於2017-02-22
本章節分享一段程式碼例項,它利用css3實現了太極圖效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style type="text/css">
* {
  margin: 0;
  padding: 0;
}
html {
  font-size: 62.5%;
}
body {
  font-family: "mircoft yahei";
  font-size: 14px;
  font-size: 1.4rem;
  line-height: 1;
}
.taiji {
  margin: 100px auto;
  width: 96px;
  height: 48px;
  background-color: #fff;
  border-color: #271CF3;
  border-style: solid;
  border-width: 2px 2px 50px 2px;
  border-radius: 100%;
  position: relative;
}
.taiji:before {
  position: absolute;
  content: '';
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  background-color: #fff;
  border: 18px solid #271CF3;
  border-radius: 100%;
}
.taiji:after {
  position: absolute;
  content: '';
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  background-color: #271CF3;
  border: 18px solid white;
  border-radius: 100%;
}
</style>
</head>
<body>
<div class="taiji"></div>
</body>
</html>

相關文章