【发布时间】:2021-11-22 00:02:53
【问题描述】:
我想对齐卡片的内容,这样当内容的标题太长时,Created on、By 和 View 等其他详细信息将位于同一行。我已经尝试使用带有min-height 的固定高度作为标题行,但我认为这不是一个好的解决方案,因为当标题较短时,会有很多空白/空白空间。
我也尝试在标题上使用flex-grow: 1,但它也不会填满空白处。
<Col>
<Card
className='text-center'
style={{
height: '100%',
padding: '15px',
borderRadius: '20px',
boxShadow: '0px 5px 15px 0px rgb(0 0 0 / 20%)'
}}
>
<Row style={{marginBottom: '5px'}}>
<Col md={6} style={{textAlign: 'left'}}>
<div
className='btn btn-success'}
style={{padding: '5px 25px', borderRadius: '50px', cursor: 'default', textTransform: 'capitalize'}}
>
{bulletin.liveStatus}
</div>
</Col>
<Col md={6} style={{textAlign: 'right'}}>
<div className='ellipsis-menu' ref={ref}>
<FaIcons.FaEllipsisH onClick={showDropDown} style={{cursor: 'pointer'}} />
</Col>
</Row>
<div className='view-bulletin-link'>
<Card.Img variant='top' src={imageCoverUrl} style={{objectFit: 'cover', height: '15rem', width: '100%', display: 'block'}}/>
<Card.Body>
<Card.Title style={{fontSize: '1rem'}}><strong>{bulletin.title}</strong></Card.Title>
<Card.Text>Created on {moment(bulletin.createdDate).format("DD/MM/YYYY")} <br />By {bulletin.createdBy}</Card.Text>
<Card.Text>{bulletin.viewCount > 1 ? <>{bulletin.viewCount} Views</> : <>{bulletin.viewCount} View</>}</Card.Text>
</Card.Body>
</div>
</Card>
</Col>
【问题讨论】:
标签: css reactjs react-bootstrap