背景尺寸
作者:
琪33 | 来源:发表于
2018-04-25 09:32 被阅读0次 <style>
.box{
width: 500px;
height: 500px;
border: 1px solid #000;
margin:100px auto;
background:url(images/baby0.jpg) no-repeat;
/* 控制背景的大小*/
/*具体数值*/
/*background-size: 500px 500px;*/
/* 百分比*/
/*background-size:50% 50%;*/
/* cover 覆盖 contain: 包含*/
/* cover 会保证完全覆盖盒子,但不能保证完整显示*/
background-size:cover;
/*contain :包含*/
/* 保证背景图片最大化的在盒子中等比例显示,但不保证能铺满盒子*/
/*background-size: contain;*/
}
</style>
</head>
<body>
<div class="box"></div>
</body>
本文标题:背景尺寸
本文链接:https://www.haomeiwen.com/subject/yzdelftx.html
网友评论