【发布时间】:2021-09-09 10:56:06
【问题描述】:
我想把{item.message} 放在卡片图片旁边。如何做到这一点
file.js
<div>
<Row>
<Container>
<div><h2>Our Mission</h2></div>
<Carousel pause='hover' variant='dark' className=" my-0 p-0 " >
{items ? items.map((item) => (
<Carousel.Item key={item._id}>
<Card style={{ width: 'auto' , height: '30rem', align:'center'}}>
<Card.Header>{item.member_of_Panel}</Card.Header>
<Card.Img src={item.image}/>
<Card.Text>{item.message}</Card.Text>
</Card>
</Carousel.Item>
)) : <Loader/>}
</Carousel></Container>
</Row>
</div>
index.css是
/* carousel
/* /* .carousel-item-next, */
.carousel-item-prev,
.carousel-item.active {
display: flex;
} */
.carousel-caption {
position: absolute;
top: 0;
}
.carousel-caption h4 {
color: rgb(5, 63, 27);
}
.carousel img {
display:block;
height: 400px;
width: 400px;
padding: 1px;
margin: 1px;
border-radius: 1%;
margin-left: 10%;
margin-right: auto;
align-items: right;
}
.carousel a {
margin: 0 auto;
}
@media (max-width: 900px) {
.carousel-caption h2 {
font-size: 2.5vw;
}
} *
.video-responsive {
overflow: hidden;
padding-bottom: 56.25%;
position: relative;
height: 0;
}
.video-responsive iframe {
left: 0;
top: 0;
height: 100%;
width: 100%;
position: absolute;
}
当前图像完全对齐但是如果我在图像属性之后将文本放在那里它会自动对齐图像的底部。如何实现此功能,以便我可以将 Message 属性放在 img 属性旁边
【问题讨论】:
-
我阅读了引导文档,无法使用它们的类将图像放在左侧,然后将卡片标题或文本放在右侧
标签: html css reactjs bootstrap-4 react-bootstrap