在网页设计中,经常会使用边框和背景图来美化页面,但是传统的边框和背景图都是规则的,无法满足设计师的创意需求。为了解决这个问题,CSS中提供了不规则边框和背景图的实现方式。 不规则边框 不规则边框可以为...
在网页设计中,经常会使用边框和背景图来美化页面,但是传统的边框和背景图都是规则的,无法满足设计师的创意需求。为了解决这个问题,CSS中提供了不规则边框和背景图的实现方式。
不规则边框
不规则边框可以为页面带来更多的创意元素,比如可以是折线、波浪线、破线等任何形状。
实现方式如下:
html
<style>
.border {
border-top: 4px dotted #333;
border-left: 4px solid #333;
border-bottom: 4px solid #333;
border-right: 4px dotted #333;
<br>
height: 200px;
width: 200px;
}
</style>
<br>
<div class="border">不规则边框</div> html
<style>
.background {
background-image: url('leaf.png');
background-repeat: no-repeat;
background-size: cover;
height: 200px;
padding: 20px;
}
</style>
<br>
<div class="background">不规则背景图</div>