【发布时间】:2018-10-19 12:26:09
【问题描述】:
我从 Material-ui-next 开始,在显示图像时遇到了一些问题,它们使用了容器的整个大小。 例如。我用:
const styles = theme => ({
Card: {
width: 300,
margin: 'auto'
},
Media: {
height: 550
}
});
在渲染中:
<Card className={classes.Card}>
<CardMedia
className={classes.Media}
image={ImgPomodoR}
title="a pomodoro tomatoe timer in material design"
/>
<CardContent>
<Typography gutterBottom variant="headline" component="h2">
...
文档说我必须指定要显示的图像的高度。 “媒体”示例将图像的高度设为 0,但是,如果我应用我的图像不会显示 - mentioned example。
现在,对我来说,这是 Media-height 的反复试验,它适合 Card 容器而不被裁剪。 有没有“自动”的方式来做到这一点?
非常感谢任何帮助, 朋友们加油,
托比亚斯
编辑:我应该提到height: "100%" // maxHeight: "100%" 对我也不起作用。
【问题讨论】:
标签: css reactjs material-ui image-size