您好,欢迎访问一九零五行业门户网

css怎么设置图片拉伸不重复

css设置图片拉伸不重复的方法:首先通过“background: url(../../../static/imagic/sy.jpg)”设置图片路径;然后通过“no-repeat”属性设置图片不重复即可。
本文操作环境:windows7系统、html5&&css3版,dell g3电脑
css设置背景图片拉伸全屏不重复
话不多说直接上图我们只给了宽和高100%就会出现这种状况
<template> <div class="hello"></div></template> <script>export default { name: "helloworld", data() { return {}; }};</script>
<style scoped>.hello { background: url("../../../static/imagic/sy.jpg") no-repeat; height: 100%; width: 100%; background-size: cover;//全屏展示}</style>
background: url(../../../static/imagic/sy.jpg) ——图片路径的位置;
no-repeat—— 图片不重复;
center 0px——center是距离页面左边的定位,0px是距离页面上面的定位;
background-position: center 0——就是图片的定位,同上;
background-size: cover;——把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。背景图像的某些部分也许无法显示在背景定位区域中;
min-height: 100vh;——视窗的高度,“视区”所指为浏览器内部的可视区域大小,即window.innerwidth/ window.innerheight大小。
推荐学习:《css视频教程》
以上就是css怎么设置图片拉伸不重复的详细内容。
其它类似信息

推荐信息