可以用两个div,一个用来做背景,设置border,一个写内容
菜鸟教程(runoob.com).content {
height: 50px;
background: #58a;
border: 0px solid #ccc;
background: linear-gradient(135deg, transparent 15px, #fff 0) top left,
linear-gradient(-135deg, transparent 15px, #fff 0) top right,
linear-gradient(-45deg, transparent 15px, #fff 0) bottom right,
linear-gradient(45deg, transparent 15px, #fff 0) bottom left;
background-size: 50% 50%;
background-repeat: no-repeat;
}
.wrap{
height: 50px;
background: #58a;
border: 0px solid #ccc;
background: linear-gradient(135deg, transparent 15px, #ccc 0) top left,
linear-gradient(-135deg, transparent 15px, #ccc 0) top right,
linear-gradient(-45deg, transparent 15px, #ccc 0) bottom right,
linear-gradient(45deg, transparent 15px, #ccc 0) bottom left;
background-size: 50% 50%;
background-repeat: no-repeat;
}
渐变背景
注意: Internet Explorer 9 及之前的版本不支持渐变。
图片描述