【发布时间】:2020-08-23 19:36:36
【问题描述】:
如果我的 Cardheader 超过了父母的宽度(卡片宽度),我该如何正确地在标题中添加点。到目前为止,我已经这样做了:
card: {
width: 275,
display: "flex"
},
overflowWithDots: {
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
width: '100px'
}
<Card className={classes.card}>
<CardHeader
title={
<Typography gutterBottom variant="h6" component="h4" className={classes.overflowWithDots}>
{movie.title}
</Typography>
}
/>
这在某种程度上是可行的,但我必须告诉类的宽度为 100 像素,直到它添加点为止。如果超出父母的宽度,我需要添加点。
【问题讨论】:
标签: javascript css reactjs material-ui