1. 程式人生 > >背景圖片利用backgrond-posintion屬性實現不同形式的分割

背景圖片利用backgrond-posintion屬性實現不同形式的分割

utf title borde images set absolut font 圖片 charset

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>背景圖片2</title>
<style>
/*.content .part{
width:800px;height:100px;
border: 2px solid black;
background-image:url(‘images/1.jpg‘);
background-size: 100% 500%;
}
.content .part1{background-position:0% 0%;}
.content .part2{background-position:0% 25%;}
.content .part3{background-position:0% 50%;}
.content .part4{background-position:0% 75%;}
.content .part5{background-position:0% 100%;}*/
/*.content{font-size: 0;}
.content .part{
width:100px;height:800px;
border: 2px solid black;
background-image:url(‘images/1.jpg‘);
background-size: 500% 100%;
display: inline-block;

}
.content .part1{background-position:0% 0%;}
.content .part2{background-position:25% 0%;}
.content .part3{background-position:50% 0%;}
.content .part4{background-position:75% 0%;}
.content .part5{background-position:100% 0%;}*/

.content{font-size: 0;position: relative;}
.content .part{
width:400px;height:400px;
border: 2px solid black;
background-image:url(‘images/1.jpg‘);
background-size: 200% 200%;
display: inline-block;

}
.content .part1{background-position:0% 0% ;}
.content .part2{background-position:100% 0%;}
.content .part3{
background-position:0% 100%;
position: absolute;
top: 100%;left: 0;
}
.content .part4{
background-position:100% 100%;
position: absolute;
top: 100%;left: 21.4%;
}

</style>
</head>
<body>
<div class="content">
<div class="part part1"></div>
<div class="part part2"></div>
<div class="part part3"></div>
<div class="part part4"></div>
</div>
</body>
</html>

背景圖片利用backgrond-posintion屬性實現不同形式的分割