Tôi đang cố gắng chuyển đổi mã bên dưới về cơ bản thành phiên bản có thể mở rộng, tôi đã thử sử dụng vw và vh,% values etc etc và tôi dường như không nhận được số dư đúng của các giá trị hoạt động . Bất kỳ trợ giúp được đánh giá cao.Tỷ lệ phần trăm css có thể mở rộng
codepen này cũng có thể giúp: http://codepen.io/anon/pen/dPNgvP
.arrow {
position: relative;
height: 0px;
width: 0px;
border-top: 18px solid #dd1111;
border-left: 11px solid transparent;
border-right: 11px solid transparent;
position: absolute;
bottom: 40px;
left: 57px;
z-index: 1;
animation: load-arrow 1.6s linear;
animation-fill-mode: forwards;
-webkit-animation: load-arrow 1.6s linear;
-webkit-animation-fill-mode: forwards;
}
@keyframes load-arrow {
from {
transform: translate(0, 0);
}
to {
transform: translate(0, 55px);
}
}
@-webkit-keyframes load-arrow {
from {
-webkit-transform: translate(0, 0);
}
to {
-webkit-transform: translate(0, 55px);
}
}
.pie {
width: 140px;
height: 140px;
position: relative;
border-radius: 140px;
background-color: #DD1111;
float: left;
margin-right: 10px;
}
.pie .title {
position: absolute;
bottom: -40px;
text-align: center;
width: 100%;
}
.mask {
position: absolute;
width: 100%;
height: 100%;
}
.pie1 .inner-right {
transform: rotate(160deg);
animation: load-right-pie-1 1s linear;
-webkit-animation: load-right-pie-1 1s linear;
-webkit-transform: rotate(160deg);
}
@keyframes load-right-pie-1 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(160deg);
}
}
@-webkit-keyframes load-right-pie-1 {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(160deg);
}
}
.outer-left {
clip: rect(0px 70px 140px 0px);
}
.outer-right {
clip: rect(0px 140px 140px 70px);
}
.inner-left {
background-color: #710000;
position: absolute;
width: 100%;
height: 100%;
border-radius: 100%;
clip: rect(0px 70px 140px 0px);
transform: rotate(-180deg);
-webkit-transform: rotate(-180deg);
}
.inner-right {
background-color: #710000;
position: absolute;
width: 100%;
height: 100%;
border-radius: 100%;
clip: rect(0px 70px 140px 0px);
transform: rotate(180deg);
-webkit-transform: rotate(180deg);
}
.content {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #fff;
position: absolute;
top: 20px;
left: 20px;
line-height: 100px;
font-family: arial, sans-serif;
font-size: 35px;
text-align: center;
z-index: 2;
}
.content span {
opacity: 0;
animation: load-content 3s;
animation-fill-mode: forwards;
animation-delay: 0.6s;
-webkit-animation: load-content 3s;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0.6s;
}
@keyframes load-content {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes load-content {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
<div class="pie pie1">
<div class="title">Twitter</div>
<div class="outer-right mask">
<div class="inner-right"></div>
</div>
<div class="outer-left mask">
<div class="inner-left"></div>
</div>
<div class="content">
<span>44%</span>
</div>
</div>
Điều này có thể được đơn giản hóa đến dưới 10 dòng (bao gồm cả hình ảnh động) nếu bạn sử dụng 'svg'. –
Tôi chưa bao giờ sử dụng SVG vì thế tại sao tôi không sử dụng nó ... nhưng cảm thấy tự do để chỉ cho tôi cách –
Chắc chắn, tôi sẽ viết một câu trả lời. :) –