css3 背景图片(背景大小和多背景图)

CSS3的背景图片大小可以写成 background-size:Apx Bpx;
-Apx = x轴(图片宽度)
-Bpx = y轴(图片高度)

了解了这些,我们开始体验这个特性吧:
最好支持CSS3背景大小的浏览器是Safari和Opera,所以我们只需要使用-o和-webkit前缀。

#backgroundSize{
	border: 5px solid #bd9ec4;
	background:url(image_1.extention) bottom right no-repeat;
	-o-background-size: 150px 250px;
	-webkit-background-size: 150px 250px;
	padding: 15px 25px;
	height: inherit;
	width: 590px;
}

为了在CSS3中应用多背景图片,我们使用都好隔开,例如:

background: url(image_1.extention) top right no-repeat, url(image_2.extention) bottom right no-repeat;

#backgroundMultiple{
	border: 5px solid #9e9aab;
	background:url(image_1.extention) top left no-repeat,
	url(image_2.extention) bottom left no-repeat,
	url(image_3.extention) bottom right no-repeat;
	padding: 15px 25px;
	height: inherit;
	width: 590px;
}

你可能感兴趣的:(css3 背景图片(背景大小和多背景图))