Ways to eliminate whitespace in React and Bootstrap 5

I have a pet project that requires mobile responsiveness, and I'm encountering an issue with white space in the Carousel component. I am unsure of how to remove it - can anyone provide assistance?

Here is how the page looks on PC: https://i.sstatic.net/ql0FO.jpg

This is how it appears on mobile devices: https://i.sstatic.net/FXR25.jpg

I would like to eliminate the empty space at the bottom and make the carousel responsive. How can I achieve this?

Below is the code for my Carousel component:

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>
                                
            
        )
    }
}

And here is the code for 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>
            </>
        )
    }
}

Answer №1

I'm a bit puzzled by your statement:

How can I remove the empty space at the bottom and make the carousel responsive?

Are you referring to the red area in this image?

https://i.sstatic.net/OnEWB.png

The reason for that is because you have

sticky="bot"

in:

<MDBFooter sticky="bot" bgColor='light' className='text-center text-lg-left' class="fixed-bottom">

which is achieving what you are looking for.

If you want the carousel to be full height, you will need to include that in the component specific to that viewport size, check out sizing for reference.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Slow fading transitions are now available in Bootstrap 5's carousel feature

I'm struggling to achieve the fade effect with Bootstrap 5 Carousel. I want the images to smoothly fade-in and fade-out, but so far, I haven't been successful. I've attempted the following solutions: Bootstrap Carousel - how to fade between ...

Auto-fit HTML Webpage Resizer Simplified

Just finished my very first jQuery project, a simple full-width slider. I've been focusing on HTML & CSS and currently working with C#. The problem is that I don't want the page to be scrollable; I want it to autofit to the webpage. Imagine ope ...

Toggle the current list item in Jquery to expand to 100% width, while simultaneously shifting any adjacent items on the left and right downwards if present

I am working with a list (ul) that contains multiple items displayed in a tiled format. Each item has a brief introduction and can expand to show more information when clicked on. What I would like to achieve is for the expanded item to take up the entire ...

Hiding overflow when navigating back a page in Safari

I need help finding a solution to this issue. On my website, the results page works perfectly fine until I navigate to a product's details page and then return to the results using the "page before" button. At that point, the overflow becomes hidden, ...

jQuery and CSS animation implemented on website performs flawlessly on all browsers, with the exception

I have recently started learning jQuery and I am facing an issue with the website linked below. It works perfectly in Firefox, Chrome, and Opera but not in Safari. <head> <meta charset="UTF-8"> <meta name="viewport" content="width=devic ...

Using Thymeleaf in Spring MVC to link a .css file to your webpage

I am currently working on a project using spring MVC and Thymeleaf. I have encountered an issue regarding how to reference my CSS files within my folder structure: src main webapp resources myCssFolder myCssFile.css web-inf ...

What could be the reason React components are not showing up on the screen?

Exploring the world of react, I decided to experiment with creating a bootstrap template. However, I ran into an issue where react does not recognize the components when compiling. app.js import React from "react"; import { BrowserRouter as Rout ...

Toggle class with jquery if the checkbox is checked

I am trying to achieve a simple task using jQuery. I have a checkbox inside a box, and I want to toggle a class on the box with a transition when the checkbox is checked. However, my code is not working as expected. Here is what I have: $(document).ready( ...

How can React useEffects avoid an infinite loop when using setData()?

const [resourceType, setResourceType] = useState("posts"); const [data, setData] = useState(""); useEffect(() => { console.log("use effects called: " + resourceType); fetch(`https://jsonplaceholder.typicode.com/${resourceType}`) .then((result ...

The color of the button in HTML5 will remain constant and not shift

I have several buttons that function like radio buttons - only one can be selected at a time: <button id="btn-bronze" name="btn-bronze" type="button" class="blue-selected">Bronze</button> <button id="btn-silver" name="btn-silver" type="butt ...

Flashing text compatibility across all browsers

I'm looking for a way to create text that blinks on all major web browsers. Initially, I attempted using the <blink> HTML tag, but unfortunately, it only works in Mozilla Firefox. Next, I experimented with CSS: <style> .blink {text-deco ...

What's the best way to arrange a series of images in a horizontal line using html and css?

Looking for a way to display a list of images in a straight line with just the right amount of spacing between them? Check out my fiddle and see the challenge I'm facing. https://i.sstatic.net/ZvICc.png I've been experimenting with HTML c ...

Error: The specified type definition file for '__mocks__' could not be located

I encountered this error upon transitioning to yarn workspaces and turbo for my collection of nextjs projects. Although it appears to be associated with jest, none of my package.json files contain jest. I have a hunch that it might be linked to a sub-depen ...

Having trouble getting PostCSS nesting to work with CSS variables in Tailwind CSS and Next.js?

I've been attempting to utilize PostCSS nesting alongside CSS variables, but unfortunately the CSS variables are not being converted at all. Instead, I am seeing Invalid property value in the DOM for CSS Variables. The tailwind.css file I have inclu ...

What impact does utilizing CSS 3D Transforms have on search engine optimization (SEO)?

Google emphasizes the importance of not hiding content, as it may not be counted by search engines. However, Google Cache has shown some discrepancies in understanding certain elements correctly. It's possible that what Google perceives as hidden migh ...

Placing a table within a div causes the div to expand in width beyond 100%

A situation has arisen where a table with a large number of columns (30 columns) is being affected by the white-space:nowrap style set on each th tag, causing the parent div to stretch unnaturally. How can this issue be resolved and allow for a horizonta ...

Can you tell me the proper term for the element that allows CSS properties to be changed after a link has been clicked?

I have integrated a horizontal scrolling date selector on my website, and it is functioning well. However, I am facing an issue while trying to change the CSS properties of a clicked date link using jQuery. Despite successfully firing the click event, I am ...

Activate the Bootstrap 5 responsive font sizing feature (RFS) for the base font elements

I'm attempting to utilize Bootstrap's RFS functionality in version 5.1.3 to apply font sizing globally. Within my SCSS file, I've defined some basic font sizes, imported the Bootstrap SCSS files, and configured the font size settings. Howev ...

Font sizes may vary depending on whether the site is accessed with or without the "www" prefix

There is an odd occurrence on my website where the font size seems to change when viewing both the www version and non-www version. While setting up a 301 redirect is a common solution, I am intrigued by why this discrepancy exists as it is not something ...

Directional Div CSS Transition

Is it feasible to determine the starting direction of a CSS transition? I've designed a div that enlarges in height when hovered over; however, it's situated at the bottom of the page, causing the scrollbar to extend downward. Ideally, I would ...