Struggling to eliminate excess white space on my site

I am in the process of creating a website using react-bootstrap. However, I have encountered an issue where there is excessive white space on the right side of the website. It seems that the default width of my website has expanded unintentionally. Currently, my website consists of 5 main components:

  1. Header
  2. About
  3. Gallery
  4. Destination
  5. Footer

Even after deleting all the CSS code, the white space persists. The only time the white space disappears is when I remove all components except for the Header. Does anyone have a solution for this issue?

    <div>
      <Header/>

      <Row className="aboutus regular">
        <Col className="aboutusleft" md="12" lg ="6" >
            <h1 className="semibold"> About Us</h1>
            <hr style={{width:'23%', margin:'0', border:'2px solid #10255A'}}></hr>

            <p>Diamond Hotel serves as an urban oasis for both discerning business and leisure travelers. Located in the heart of Samarinda and close to the most prominent culinary tourism object. The hotel itself possess a trendy design with attention to comfort, quality and value based accommodation. It features 75 modern rooms and suites with contemporary design environment to make you feel completely at home.</p>

            <button className="aboutbutton">Learn More</button>
        </Col>

        <Col className="aboutusright text-center" md="12" lg ="6">
          <img src="./img/Group4.png"></img>
        </Col>
      </Row>

      <Row className="gallery">
        <Col className="galleryleft" lg="5">
          <h1>Gallery</h1>
          <hr style={{width:'40%', margin:'0', border:'2px solid #967A50'}}></hr>

          <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur</p>
        </Col>

        <Col className="galleryright" lg="7">
          <Carousel fade>
            <Carousel.Item interval={1000}>
              <img
                className="d-block w-100"
                src="#"
                alt="First slide"
              />
              <Carousel.Caption>
                <h3>First slide label</h3>
              </Carousel.Caption>
            </Carousel.Item>

            <Carousel.Item interval={1000}>
              <img
                className="d-block w-100"
                src="#"
                alt="Second slide"
              />

              <Carousel.Caption>
                <h3>Second slide label</h3>
              </Carousel.Caption>
            </Carousel.Item>

            <Carousel.Item interval={1000}>
              <img
                className="d-block w-100"
                src="#"
                alt="Third slide"
              />

              <Carousel.Caption>
                <h3>Third slide label</h3>
              </Carousel.Caption>
            </Carousel.Item>
          </Carousel>
        </Col>
      </Row>

      <Row className="services">
        <Col className="servicesleft" sm="12" md="12" lg="6">
          <h1>Services During <br/>Your Stay</h1>
          <hr style={{width:'36%', border:'2px solid #967A50'}}></hr>

          <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.</p>
        </Col>

        <Col sm="12" md="12" lg="6">
          <Row className="text-center">
            <Col className="qualityside">
              <img src="./img/bed.png" alt="Bed_logo"></img>
              <h2>High quality bed</h2>

              <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature.</p>
            </Col>

            <Col className="qualityside">
              <img src="./img/concierge.png" alt="Concierge_logo"></img>
              <h2>Concierge Service</h2>

              <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature.</p>
            </Col>
          </Row>

          <Row className="text-center">
            <Col className="qualityside">
              <img src="./img/location.png" alt="Location_logo"></img>
              <h2>Downtown Area</h2>

              <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature.</p>
            </Col>

            <Col className="qualityside">
              <img src="./img/wifi.png" alt="Wifi_logo"></img>
              <h2>24/H Wifi Access</h2>

              <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature.</p>
            </Col>
          </Row>

        </Col>
      </Row>
    
      <Footer />
    </div>

To set the default HTML styling, I have included the following CSS:

html,body{
    margin:0;
    padding:0;
    font-weight: 400;
    font-family: Montserrat, "Open Sans", Helvetica, Arial, sans-serif;
}

Answer №1

Here is an example of how to structure your code:

  body {
        margin:0;
        padding:0;
        font-weight: 400;
        font-family: Montserrat, 'Open Sans', Helvetica, Arial, sans-serif;
        box-sizing: border-box;
    } 

       <Container>
         <Row>
           <Components ... />
         </Row>
       </Container>

Answer №2

One common issue I encounter with bootstrap is when a "row" is not enclosed within a "container". To troubleshoot this, open your browser's inspector tool and systematically remove sections to identify the problematic one.

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

JavaScript Lint Warning: Avoid declaring functions inside a loop - unfortunately, there is no way to bypass this issue

In my React JS code snippet, I am attempting to search for a value within an object called 'categories' and then add the corresponding key-value pair into a new map named sortedCategories. var categoriesToSort = []; //categoriesToSort contains ...

Having trouble with adding data from an array of objects to an HTML element using jQuery's each method

I am currently facing an issue with looping through an array of objects using $.each in jQuery and trying to append the values to an <li>. Here is the relevant jQuery code: $(".sidebar").empty().append("<div>" + "<h5>Student Info</ ...

Utilize Tailwind CSS in React to dynamically highlight the active navigation item on click

Check out my navigation bar code: <nav className="bg-white shadow dark:bg-gray-800"> <div className="container flex items-center justify-center p-6 mx-auto text-gray-600 capitalize dark:text-gray-300"> <Link ...

What functions do the accelerometer, gyroscope, and picture-in-picture serve in the HTML code for embedding a YouTube video?

After successfully uploading a video on Youtube, you will be provided with the following HTML code for embedding: <iframe width="560" height="315" src="https://www.youtube.com/embed/UF8uR6Z6KLc" frameborder="0" allow="accelerometer; autoplay; encrypt ...

The type '{ children: Element[]; }' does not include the properties 'location' and 'navigator' that are present in the 'RouterProps' type

Struggling to implement React Router V6 with TypeScript, encountering a type error when including Routes within the `<Router />` component. The error message indicates that the children property passed to the Router is of an incorrect type, despite u ...

The battle between DataBind and control property settings

When considering these two methods: <asp:Label ID="Label1" runat="server"><%# DateTime.Now %></asp:Label> and Label1.Text = DateTime.Now.ToString(); Which approach do you prefer and what is your reasoning behind it? ...

What could be the reason overflow:hidden isn't functioning properly in IE6?

Would you mind checking this out? http://jsfiddle.net/UQNJA/1/ It displays correctly in all updated browsers, including IE7/8 and 9. However, in IE6, the red and pink borders do not contain the floated <li>s. Any suggestions on how to fix this issu ...

Conflicting React types found in pnpm monorepo

In the process of converting an inherited monorepo from yarn+lerna to pnpm workspaces, I am encountering some issues. Specifically, there are mismatching React versions causing errors in typescript. It seems that TypeScript is not recognizing the closest @ ...

What causes the Bootstrap navbar dropdown to be partially obscured in IE8?

While working on a specific project, I have encountered an issue where everything seems to function properly in newer browsers except for IE8 during testing. The dropdown menu is functional, however, it appears hidden behind the main content area labeled ...

Creating a dynamic 3x3 layout using flexbox: a step-by-step guide

Is it possible to dynamically create a layout in Next.js with 3 columns of 3 rows using flexbox, React Bootstrap, or CSS only? https://i.sstatic.net/tTinS.jpg ...

Obtain the coordinates by clicking within the iframe and extending to the parent page

On my webpage, I have implemented an iframe that displays a small square containing information when clicked. However, I am facing an issue with the coordinates provided by the iframe via post message. The coordinates are accurate except when scrolling wit ...

Concealing a CSS class with PHP within the Wordpress Woocommerce platform

I have very limited knowledge in programming and need help with a code snippet. I am using the Wordpress Snippets Plugin to hide the Add Cart Button from a single product. add_action( 'wp', 'rudr_remove_add_to_cart_single_product' ); fu ...

Opting for Fetch API over Ajax for requests that involve Allow-Credentials and require POST methods

In this particular scenario, the utilization of Access-Control-Allow-Credentials accompanied by the POST method is key in managing server-side PHP session variables that need to remain stable. To provide some context, the front-end aspect involves a creat ...

The div is not displaying the background image as intended

.cover-image { margin-bottom: 0px; height: 350px; color: white; text-shadow: black 0.3em 0.3em 0.3em; } <div class="cover-image" style="background: url('~/images/hdpic.jpg') no-repeat; background-size:cover"> </div> I&apo ...

Scrolling behavior in two columns with sticky positioning

Both columns have varying heights, with the left sometimes higher than the right. I want them to start scrolling down simultaneously, but when the shorter column's content ends, it should stick to the bottom of the viewport and "wait" until the taller ...

What's the best way to add two distinct colors as background for a header with css?

h2 {background-color:#C61236; color:#FFFFFF; font-size:medium; line-height:1.5; text-indent:20px;} Although the current setup looks good, I am looking to incorporate a new color block at the start of the text. I'm not sure what steps to take nex ...

Invoke a function within the redux reducer

The code within my reducer is structured as follows: import {ADD_FILTER, REMOVE_FILTER} from "../../../../actions/types"; const removeFilter = (state, name) => { return state.filter(f => f.name !== name); }; export default function addRemoveFi ...

What is the best method for gracefully opening external links in a reusable new tab?

Here is the progress I have made so far: <script> var win; function OpenInNewTab(url ) { // var win; if (win) { win.close(); } win =window.open(url, 'myWin'); win.focus(); } </script> My links are structured like ...

Every day, I challenge myself to build my skills in react by completing various tasks. Currently, I am facing a particular task that has me stumped. Is there anyone out there who could offer

Objective:- Input: Ask user to enter a number On change: Calculate the square of the number entered by the user Display each calculation as a list in the Document Object Model (DOM) in real-time If Backspace is pressed: Delete the last calculated resul ...

Is there a way to send me the result of the radio input (Yes/No) via email?

Is it feasible to send the results of a radio input (Yes/No) back to my email directly using HTML, CSS, and Javascript? ...