使用 Material UI 的 Card 时。我遇到了一个我通常不会遇到的问题。盒子阴影在底部和顶部手侧被切除。
我怎样才能解决这个问题?
我的代码在这里:
import React, { Component } from 'react'
import './demo.css'
import { Card } from '@material-ui/core';
export default class MasonryLayout extends Component {
render() {
return (
<div className="masonry">
<Card className="item" style={{height:"120px"}} elevation={4}/>
<Card className="item" style={{height:"190px"}} elevation={4}/>
<Card className="item" style={{height:"220px"}} elevation={4}/>
<Card className="item" style={{height:"130px"}} elevation={4}/>
<Card className="item" style={{height:"140px"}} elevation={4}/>
</div>
)
}
}Run Code Online (Sandbox Code Playgroud)
.masonry {
column-count: 2;
column-gap: 56px;
margin: 50px;
}
.item {
margin-bottom: 40px;
break-inside: avoid;
}Run Code Online (Sandbox Code Playgroud)
截图炸了: