前言
css中可以通过background-size属性来设定背景图片的大小。例说明:background-size:950px 200px;
/* 一个值: 这个值指定图片宽度,第二个值为auto */
/* 两个值: 第一个值指定图片的宽度,第二个值指定图片的高度 */
css代码
.div_button{
width: 3.71rem;
height: 0.95rem;
background-size:3.71rem 0.95rem;/*设置背景图片大小*/
font-size:0.36rem;
color:rgba(254,254,254,1);
}
html代码
<div class="div_button sxzyjz" style="background-image: url(../img/hongse.png);">
首页
</div>