css - is it possible to shrink background image and keep the offsets
问题描述
I have an image that contains multiple images with x and y offsets
Is it possible to use this offsets and then shrink the image to a different width and height ?
Here is a sample of the image i get and the desired output
Thanks in advance
.container {
width: 960px;
}
.full {
background: url('http://ddragon.leagueoflegends.com/cdn/8.5.2/img/sprite/champion1.png') no-repeat;
width: 100%;
height: 200px;
}
.img-container {
width: 40px;
height: 40px
}
.shrinked {
background: url('http://ddragon.leagueoflegends.com/cdn/8.5.2/img/sprite/champion1.png') -48px -48px no-repeat;
height: 100%;
width: 100%;
}
<div class="container">
full image
<div class="full"></div>
40px centered
<div class="img-container">
<div class="shrinked"></div>
</div>
</div>
解决方案
推荐阅读
- http - 将非 WWW 站点重定向到 https:// IIS
- php - Laravel:SQLSTATE [42S22]:找不到列:1054“字段列表”中的未知列“文件”
- python - 如何在两个字典中使用多个键列表值
- python - Conda 不允许我激活环境
- excel - 如何在宏中使用替换函数将字符替换为其他字符
- git - git subtree:内部项目包括外部项目的整个历史。这是预期的吗?
- xml - 目录中的类似 XML 配置文件需要更新 - 在 SingleNode 中添加新属性和替换现有属性
- angular - 如何使用 ngx-build-plus (extra-webpack-config) 运行 e2e 测试?
- llvm - 编写 LLVM 转换通道以在每个函数的开头注入延迟
- javascript - 根据某些条件从嵌套的 Javascript 对象中获取键