英文:
How to remove empty space in React and Bootstrap 5
问题
I'm writing a pet project that needs to be mobile responsive and I have a problem with white space in the Carousel component, I don't know how to remove it, can someone help me?
This is looks like page on PC
https://i.stack.imgur.com/ql0FO.jpg
This is looks like mobile devices https://i.stack.imgur.com/FXR25.jpg
And I want to remove the empty space at the bottom, make the carousel responsive, how can I do that?
Here is my component code
import ...
export default class CarouselBox extends Component{
render(){
return(
<Carousel>
<Carousel.Item>
<img className="d-block w-100"
src={edinburghView1}
alt="Edinburgh_Uni"
/>
<Carousel.Caption>
<Nav.Link href='/EdinburghCity'>
<h3>Edinburgh city</h3>
<p>Edinburgh city view in 2023</p>
</Nav.Link>
</Carousel.Caption>
</Carousel.Item>
)
}
}
Here is my Footer component
import { MDBFooter } from 'mdb-react-ui-kit';
export default class Footer extends Component {
render() {
return (
<>
<MDBFooter sticky="bot" bgColor='light' className='text-center text-lg-left' class="fixed-bottom">
<div className='text-center p-3' style={{
backgroundColor: '#f8f9fa',
marginTop: '0.5%' }}>
&copy; {new Date().getFullYear()} Copyright:{' '}
<a className='text-dark' href='https://t.me/koreechdhs'>
Boiar Kostiatyn
</a>
</div>
</MDBFooter>
</>
)
}
}
英文:
I'm writing a pet project that needs to be mobile responsive and I have a problem with white space in the Carousel component, I don't know how to remove it, can someone help me?
This is looks like page on PC
https://i.stack.imgur.com/ql0FO.jpg
This is looks like mobile devices https://i.stack.imgur.com/FXR25.jpg
And I want to remove the empty space at the bottom, make the carousel responsive, how can I do that?
Here is my component code
import ...
export default class CarouselBox extends Component{
render(){
return(
<Carousel>
<Carousel.Item>
<img className="d-block w-100"
src={edinburghView1}
alt="Edinburgh_Uni"
/>
<Carousel.Caption>
<Nav.Link href='/EdinburghCity'>
<h3>Edinburgh city</h3>
<p>Edinburgh city view in 2023</p>
</Nav.Link>
</Carousel.Caption>
</Carousel.Item>
)
}
}
Here is my Footer component
import { MDBFooter } from 'mdb-react-ui-kit';
export default class Footer extends Component {
render() {
return (
<>
<MDBFooter sticky="bot" bgColor='light' className='text-center text-lg-left' class="fixed-bottom">
<div className='text-center p-3' style={{
backgroundColor: '#f8f9fa',
marginTop: '0.5%' }}>
&copy; {new Date().getFullYear()} Copyright:{' '}
<a className='text-dark' href='https://t.me/koreechdhs'>
Boiar Kostiatyn
</a>
</div>
</MDBFooter>
</>
)
}
}
答案1
得分: 1
我有点困惑您所说的是什么意思:
> 我想要移除底部的空白空间,使轮播图具有响应性,应该如何操作?
我猜您指的是这里的红色区域?
这是因为您在以下代码中使用了:
sticky="bot"
在:
<MDBFooter sticky="bot" bgColor='light' className='text-center text-lg-left' class="fixed-bottom">
这正是您想要的效果。
如果您想让轮播图占满整个高度,您需要在该视口大小的组件中添加相应的设置,参考sizing。
英文:
I'm somewhat confused what you mean by:
> I want to remove the empty space at the bottom, make the carousel responsive, how can I do that?
I'm assuming the red area here you're talking about?
That is because, you have
sticky="bot"
in:
<MDBFooter sticky="bot" bgColor='light' className='text-center text-lg-left' class="fixed-bottom">
which is doing exactly what you want.
If you want the carousel to be full height you will need to add that in the component at that viewport size, reference sizing
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论