2017-08-28 137 views
-2

我有一個div具有相同的寬度和高度邊框半徑50%,我需要像這個鏈接中顯示的這個div邊框。動畫邊界圓

`https://codepen.io/anon/pen/MbWagQ` 

我需要相同的動畫爲圓div。

+2

我需要咖啡。請參見[問] –

+1

[CSS只能使用邊框半徑和透明背景設置動畫效果](https://stackoverflow.com/questions/26807610/css-only-animate-draw-circle-with-border-半徑和 - 透明背景) –

回答

0
.draw { 
     -webkit-transition: color 0.25s; 
     transition: color 0.25s; 
     border-radius: 50%; 
    } 
    .draw::before, .draw::after { 
     border-radius: 50%; 
     border: 3px solid transparent; 
     width: 0; 
     height: 0; 
    } 
div { 
     background: none; 
     border: 0; 
     box-sizing: border-box; 
     color: #f45e61; 
     font-size: inherit; 
     font-weight: 700; 
     padding: 1em 2em; 
     text-align: center; 
     margin: 20px; 
     position: relative; 
     vertical-align: middle; 
     width:100px; 
    } 
    div::before, div::after { 
     box-sizing: border-box; 
     content: ''; 
     position: absolute; 
     width: 100%; 
     height: 100%; 
    } 

和HTML

<div class="draw">draw</div>