css實現矩形切角效果程式碼例項

admin發表於2017-03-20

分享一段程式碼例項,它實現了矩形切角效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
div {
        background: #58a;
        background:        radial-gradient(circle at top left, transparent 15px, #58a 0) top left,
                    radial-gradient(circle at top right, transparent 15px, #58a 0) top right,
                    radial-gradient(circle at bottom right, transparent 15px, #58a 0) bottom right,
                    radial-gradient(circle at bottom left, transparent 15px, #58a 0) bottom left;
        background-size: 50% 50%;
        background-repeat: no-repeat;
        padding: 1em 1.2em;
        max-width: 12em;
        color: white;
        font: 130%/1.6 Baskerville, Palatino, serif;
  text-align:center;
}
</style>
</head>
<body>
<div>螞蟻部落</div>
</body>
</html>

相關文章