CSS虚化背景图片并解决白边
Created|Updated
|Word Count:182|Post Views:
CSS虚化背景图片并去掉白边
直接上代码
App.jsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import {Layout} from "@douyinfe/semi-ui"; import "./App.css";
function App() { const {Header, Footer, Content} = Layout;
return ( <Layout className={"layout"}> <div className={"background"}/> <Header>Header</Header> <Content>Content</Content> <Footer>Footer</Footer> </Layout> ); }
export default App;
|
App.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| .background{ width: 100vw; height: 100vh; position: fixed; z-index: -1;
background-image: url("../public/枝江往事.jpg"); background-repeat: no-repeat; background-position: center; background-attachment: fixed; background-size:cover; filter: blur(3px); transform: scale(1.02); }
|
参考:去掉模糊背景或图片的白边 – Clloz ☘️