当把图片放到页面中的时候窗口是100%时图片是完全展现的,但是需要的效果是当窗口缩为小窗或检查时图片的中间部分展现在窗口上,并不是图片完全展现在缩小的窗口上,这个不知道怎样去实现。
background-image+background-size: cover;可以实现。有帮助麻烦点个采纳【本回答右上角】,谢谢~~有其他问题可以继续交流~
<style>
body{margin:0}
.bgimg {
background-image: url(http://d.paper.i4.cn/max/2016/12/23/11/1482463499468_150396.jpg);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
</style>
<body class="bgimg"></body>
用响应式布局。写属性 width:100%
在background:url() no repeat center top 就行了,使图片展示中间部分