css3實現的矩形圓角切角效果

antzone發表於2017-03-02

本章節分享一段程式碼例項,它實現了圓角切角效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style type="text/css">
.arc{
  position: absolute;
  top:50%;
  left: 50%;
  transform:translate(-50%,-50%);
  width: 60px;
  padding: 60px;
  text-align: center;
  color: white;
  font-size: 200%;
}
.arc {
  background:
    radial-gradient(circle at top left,
    transparent 15px, yellowgreen 0) top left,
    radial-gradient(circle at top right,
    transparent 15px, yellowgreen 0) top right,
    radial-gradient(circle at bottom right,
    transparent 15px, yellowgreen 0) bottom right,
    radial-gradient(circle at bottom left,
    transparent 15px, yellowgreen 0) bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}      
</style>
</head>
<body>
<div class="arc"></div>
</body>
</html>

相關文章