CSS3的背景图片大小能够写成 background-size:Apx Bpx;
-Apx = x轴(图片宽度)
-Bpx = y轴(图片高度) css
了解了这些,咱们开始体验这个特性吧:
最好支持CSS3背景大小的浏览器是Safari和Opera,因此咱们只须要使用-o和-webkit前缀。 web
#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; url
#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; }