css - 当我们最小化或最大化图像无法更改的站点时,在css中设置静态背景图像大小?
问题描述
.image {
background-image: url('task pic 1.jpeg'), url('task pic 2.jpeg'), url('task pic 3.jpeg');
background-position: left bottom, left top, center;
background-repeat: no-repeat, no-repeat, no-repeat;
margin-top: 50px;
margin-right: -200px;
margin-left: 800px;
padding: 300px;
border: 100%;
width: auto;
background-size: auto;
position: relative;
}
解决方案
您可以使用以下方法设置静态宽度/高度background-size
:
body {
margin: 0;
}
.image {
background-image: url('https://www.enterprise.ca/content/dam/ecom/general/Homepage/inspiration-banff-ca.jpg.wrend.1280.720.jpeg'), url('https://www.enterprise.ca/content/dam/ecom/general/Homepage/inspiration-banff-ca.jpg.wrend.1280.720.jpeg'), url('https://www.enterprise.ca/content/dam/ecom/general/Homepage/inspiration-banff-ca.jpg.wrend.1280.720.jpeg');
background-position: 0 0, 0 200px, 100px 100px;
background-repeat: no-repeat;
background-size: 300px;
width: 500px;
height: 500px;
position: relative;
}
<div class="image"></div>
推荐阅读
- flowchart - 如何对齐美人鱼流程图节点中的文本?
- c# - ASP.Net Web API 和 CosmosDB。无法弄清楚如何在另一个服务类中使用一个服务类
- python - 当我导入我的个人库时,pd.DataFrame 上的简单求和函数需要永远
- python-3.x - 有没有办法拥有动态类?一个构造函数,给定数据状态,自动水合不同的类?
- android - 安卓 。使用默认风味/构建类型源文件夹
- android - 后台进程和正常运行时如何使用相同的实例对象
- javascript - 用打字稿反应孩子
- python - 无法通过 Python 使用 selenium 按类名定位元素。为什么这样?
- vue.js - 如何设置页面格式vue js html-to-paper
- pandas - 在 lambda 函数中使用 pandas 数据框更新 dynamodb 表