Reputation: 41
Hi I have a problem with buttons and text on small devices it covers images. I tried to put position absolute and relative but it doesn't work . How can I fix position of buttons and text?
<Carousel>
<Carousel.Item interval={60000} style={{ position: "relativ" }}>
<img className="d-block w-100 " src={firstslide} alt="First slide" />
<Carousel.Caption
className="d-block"
style={{
left: 0,
position: "absolute",
width: " 50%",
top: "2%",
color: "black",
}}
>
<h3>iPhone 12</h3>
<div class="btn-group" role="group">
<a
className="btn btn-success"
style={{
backgroundColor: "#36d99a",
padding: "5px 30px 5px 30px",
marginRight: "10px",
borderRadius: "5px",
}}
>
Buy
</a>
<a
className="btn btn-success"
style={{
backgroundColor: "#36d99a",
padding: "5px 10px 5px 10px",
borderRadius: "5px",
}}
>
Learn More
</a>
</div>
</Carousel.Caption>
</Carousel.Item>
</Carousel>
Upvotes: 1
Views: 53
Reputation: 6743
I just changed the Carousel.Caption
to relative
it works
<Carousel>
<Carousel.Item
interval={60000}
style={{ position: 'relativ' }}
>
<Carousel.Caption
className="d-block"
style={{
right: 0,
position: 'relative',
left: 0,
margin: '0 auto',
top: '2%',
color: 'black',
}}
>
<h3>iPhone 12</h3>
<div class="btn-group" role="group">
<a
className="btn btn-success"
style={{
backgroundColor: '#36d99a',
padding: '5px 30px 5px 30px',
marginRight: '10px',
borderRadius: '5px',
minWidth: 150,
}}
>
Buy
</a>
<a
className="btn btn-success"
style={{
backgroundColor: '#36d99a',
padding: '5px 10px 5px 10px',
borderRadius: '5px',
minWidth: 150,
}}
>
Learn More
</a>
</div>
</Carousel.Caption>
<img
className="d-block w-100 "
src={
'https://www.gizmochina.com/wp-content/uploads/2020/05/iphone-12-pro-max-family-hero-all-600x600.jpg'
}
alt="First slide"
/>
</Carousel.Item>
</Carousel>
Take a look
Upvotes: 2