css - div 的 SVG 背景模糊,设置了 backgroundColor
问题描述
我正在尝试使用 svg 作为 div 元素的背景。
import backgroundHp from './../../assets/img/background_shapes_hp.svg'
<div className="layoutContainer" style={{ backgroundImage: `url(${backgroundHp})`, backgroundColor: '#1a183e', backgroundPosition: 'center 310px' }}>
... content
</div>
CSS:
.layoutContainer {
padding: 0;
overflow: hidden;
position: relative;
background-repeat: repeat-y;
background-attachment: scroll;
background-size: auto;
min-height: 100%;
}
使用此设置,我的背景变得模糊。看起来它不再是 svg 了。但是当我不设置backgroundPosition时,我的背景很清晰。左图设置了backgroundPosition,右图没有设置backgroundPosition。
我究竟做错了什么?如何设置 backgroundPositionbut 并仍然获得清晰的背景?
解决方案
推荐阅读
- python - Django ForeignKey 与中间表的关系
- julia - 激活 Julia 虚拟环境
- java - Scala案例类扩展了java类
- python - 如何在包含相同元素的另一个列表中查找一个列表的元素索引?
- c# - BlazorWebAssembly GetFromJsonAsync 不序列化子集合
- pandas - 从文本文件的特定行和列中提取数据
- python - 如何在python中不断使用Tkinter一张一张地滑动图像?
- python - 在 Python 中合并两个变量
- javascript - 更改 @everyone 权限 Discord JS 时出错
- python - 有没有更好的方法来替换文件名中的多个空格?