Jumbotron causes navigation bar to malfunction on mobile site

I'm experiencing an issue with Bootstrap Jumbotrons on my website - they extend beyond the container, causing the navbar on the mobile version to not fill the screen. This problem only occurs on pages with a jumbotron present.

Attempting to use a Card instead of the jumbotron has its own set of problems, especially when adding anything other than text.

<div class="row">
    <div class="jumbotron col-lg-8 col-md-12"
        style='margin-left: 15px; margin-top: 15px; padding-top: 10px; padding-bottom: 10px; margin-bottom: 10px;'>
        <h1 class="display-3">
            <b>Welcome to SkyWars.fun</b>
        </h1>
        <p class="lead">We focus on updating regularly, and we listen close to
            our community suggestions.</p>
        <hr class="my-4">
        <p>We have a perk system, comparable with kits or abillities. Any
            player can enable 3 perks at once. These perks give small advantages
            for your gameplay. Choose wisely, and adapt with your perks! Happy
            SkyWars! And have fun!</p>
        <p class="lead">
            <a class="btn btn-primary btn-lg" href="../tips" role="button">Tips
                and tricks</a>
        </p>
    </div>
</div>

Regarding the navbar:

<nav class="navbar navbar-expand-lg navbar-dark bg-primary" role="navigation">
    <a class="navbar-brand" href="../">IP: SkyWars.fun</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse"
        data-target="#navbarColor01" aria-controls="navbarColor01"
        aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarColor01">
        <ul class="navbar-nav mr-auto">
            <li
                class="nav-item <?php if($_SERVER['REQUEST_URI'] === '/') echo 'active' ?>"><a
                class="nav-link" href="https://www.skywars.fun/" title="Go to the main page">Home </a></li>
            <li class="nav-item <?php if(isPage('/about/')) echo 'active' ?>"><a
                class="nav-link" href="https://www.skywars.fun/about" title="Information about SkyWars.fun">About</a></li>
            <li class="nav-item <?php if(isPage('/tips/')) echo 'active' ?>"><a
                class="nav-link" href="https://www.skywars.fun/tips" title="Tips and Tricks">Tips</a></li>
            <li class="nav-item <?php if(isPage('/donate/')) echo 'active' ?>"><a
                class="nav-link" href="https://www.skywars.fun/donate" title="Donate">Donate</a></li>
            <li class="nav-item <?php if(isPage('/search/')) echo 'active' ?>"><a
                class="nav-link" href="https://www.skywars.fun/search" title="Leaderboard">Leaderboard</a></li>
        </ul>
        <form class="form-inline my-2 my-lg-0" action="../search" title="Lookup player">
            <input class="form-control mr-sm-2" type="text" name="player"
                placeholder="Search player">
            <button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
        </form>
    </div>
</nav>

Images showing the problem:

https://drive.google.com/file/d/0ByAYcnq6pPDmNlJsUUNBbkM1aFRITEQ5TUF4U0JxWXpOYVBV/view?usp=sharing https://drive.google.com/file/d/0ByAYcnq6pPDmcnVsbTNMbkI2MnlNdmZocmtXV0FWbXpmUTdN/view?usp=sharing

Answer №1

* {
   margin: 0;
   padding: 0;
}

.banner {
    background: #e9ecef;
}

@media only screen and (max-width: 767px) {
.display-3 {
    font-size: 2rem !important;
}
}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  </head>
  <body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary" role="navigation">
      <a class="navbar-brand" href="../">IP: SkyWars.fun</a>
      <button class="navbar-toggler" type="button" data-toggle="collapse"
        data-target="#navbarColor01" aria-controls="navbarColor01"
        aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarColor01">
        <ul class="navbar-nav mr-auto">
          <li
            class="nav-item <?php if($_SERVER['REQUEST_URI'] === '/') echo 'active' ?>"><a class="nav-link" href="https://www.skywars.fun/" title="Go to the main page">Home </a></li>
          <li class="nav-item <?php if(isPage('/about/')) echo 'active' ?>"><a class="nav-link" href="https://www.skywars.fun/about" title="Information about SkyWars.fun">About</a></li>
          <li class="nav-item <?php if(isPage('/tips/')) echo 'active' ?>"><a class="nav-link" href="https://www.skywars.fun/tips" title="Tips and Tricks">Tips</a></li>
          <li class="nav-item <?php if(isPage('/donate/')) echo 'active' ?>"><a class="nav-link" href="https://www.skywars.fun/donate" title="Donate">Donate</a></li>
          <li class="nav-item <?php if(isPage('/search/')) echo 'active' ?>"><a class="nav-link" href="https://www.skywars.fun/search" title="Leaderboard">Leaderboard</a></li>
        </ul>
        <form class="form-inline my-2 my-lg-0" action="../search" title="Lookup player">
          <input class="form-control mr-sm-2" type="text" name="player"
            placeholder="Search player">
          <button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
        </form>
      </div>
    </nav>
    <section class="banner">
      <div class="container-fluid">
          <div class="row">
            <div class="col-12">
              <div class="jumbotron">
                <h1 class="display-3">
                  <b>Welcome to SkyWars.fun</b>
                </h1>
                <p class="lead">We focus on updating regularly, and we listen close to
                  our community suggestions.
                </p>
                <hr class="my-4">
                <p>We have a perk system, comparable with kits or abillities. Any
                  player can enable 3 perks at once. These perks give small advantages
                  for your gameplay. Choose wisely, and adapt with your perks! Happy
                  SkyWars! And have fun!
                </p>
                <p class="lead">
                  <a class="btn btn-primary btn-lg" href="../tips" role="button">Tips
                  and tricks</a>
                </p>
              </div>
            </div>
        </div>
      </div>
    </section>
    <script
      src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
  </body>
</html>

I adjusted the font size for smaller devices to prevent overflow within the container. To maintain structure, consider using .container > .row > .col-lg-12 [as an example] before applying the main class. For further guidance, visit this link. Hopefully, this resolves your issue.

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

Adjust the translateX value and element size based on either the parent element's size or the window's dimensions

Is this question specific enough to relate to others' problems? My issue involves two elements, a child and a parent, with the child element rotating around the parent using CSS animations. <div class="planet"> <div class="moon"></di ...

How can I style <p> tags with a specific font in Tailwind Typography?

For instance, suppose I wish to utilize the markdown as shown below: # AAAAAAAAAa BBBBBBB This would then be interpreted in such a way that AAAAAAAAAa is designated as h1, BBBBBBB as <p>, and the entire content enclosed within a prose div utilizing ...

Tips for ensuring Opera browser compatibility with buttons using the CSS background image property

Is there a way to make background images work on buttons in Opera web browser using CSS? I've tried using the background image property, but it doesn't show up when I use Opera. Strangely enough, it works fine in Firefox. However, I have noticed ...

Experiencing a problem with inline JavaScript onclick

I recently came across a fantastic pure javascript code for a smooth scrolling function, but I'm struggling with integrating it into an inline onclick function. My understanding of javascript is quite limited and I could really use some help... <d ...

What is the method to store and retrieve data attributes linked to elements such as select options within the React framework?

Despite my efforts, I'm currently unable to retrieve the data attribute from an option using React as it keeps returning null. <select onChange={(e) => this.onIndustryChangeOption(e)} value={this.props.selectedIndustry}> <opti ...

When adding my Angular web app to the home screen on iOS Safari, the icon appears as a screenshot instead of the specified apple-touch-icon

Despite adding an apple-touch-icon link to my index.html with a 150x150 PNG image, when I try to add my Angular web app as a shortcut to my iOS home screen from Safari, it only appears as a screenshot of the app page. Below is my HTML code: <!doctype ...

Tips for relocating several buttons to the upper right corner

I have a dilemma with the positioning of 10 buttons on my webpage. Specifically, I would like to place them in the top right corner, but they are currently at the bottom. Can you assist me with moving the buttons? My desired outcome can be seen here. I s ...

How can one gain access to a specifically generated element?

In my task of dynamically generating multiple elements, I am facing an issue related to accessing specific ones. To illustrate this problem as simply as possible, I have provided the following code: $(document).ready(function() { var num1 = 0; v ...

Template Function Problem Detected in AngularJS Formatting

I'm struggling to incorporate my scope attributes into a template function within my custom directive. The formatting for the return section in my template is not working as expected. This is how it currently looks: angular .module(' ...

What is the method for updating the content within a div element?

I am trying to add multiple elements to my content, including an h1 element, an input field, and some buttons. I have written a function to create the h1 and input elements, but when trying to add them to my content div, I encountered an error (TypeError ...

Creating a personalized avatar using Bootstrap 5

Currently, I am working with Bootstrap 5 and am trying to create an avatar with different icons inside it, similar to a letter avatar. I want to have a placeholder where the icon can be added within it. Here is an example of what I have tried: <div widt ...

Performing JavaScript functions after fetching an XSLT page via AJAX

Is there a way to trigger JavaScript at a particular time without relying on setInterval() or onClick()? The issue I'm facing is that when I click to load an XSLT page using Ajax, the JavaScript within it does not execute even though it's writt ...

The color of the text on the Homepage appears differently on iOS Safari

At the top of my homepage, I have displayed the company phone number with white text color. It appears correctly as white on my desktop browsers (Firefox and Chrome), also on my Droid phone, but shows up as dark gray on my iOS phone using Safari. Why is th ...

ReactJS: Want to update card design by utilizing the onClick event handler

Currently, I am aware that there will be a need to refactor this code later on to separate things into their own components. However, due to time constraints, I have to wire this up as is at the moment. To achieve this, I utilized array.map() to create car ...

What is causing these dynamic carousels to malfunction in Chrome?

After using Agile Carousel successfully for a while, I am now experiencing issues with it not working properly in Safari and Chrome, although it functions fine on Firefox and Safari for iPad. On this specific page, the carousel stops at the second image, ...

Creating a custom HTML layout: A step-by-step guide

Struggling to create a unique layout in HTML and seeking assistance. Instead of words, I'll show you my current layout with images: While this works fine for now, if div1 becomes taller, the layout will look like this: My ultimate goal is to achiev ...

Printing pages with Bootstrap without disrupting cards

My goal is to print a basic bootstrap page using window.print(). Here is what the page looks like (with multiple div.col-md-12 & cards) : <div class="overview"> <!-- Takes up entire screen width --> <div class="row"> <div ...

Creating a textbox with pre-filled content

Seeking assistance with a Java compiler app I am developing through phonegap. Need help setting the default Java Class name in a textarea without it disappearing. This is what I have: <div> <label for="source">Source Code:</label> ...

Can someone please explain to me why the Transition effect is not functioning properly for input:checked::before?

Can someone please help me troubleshoot why the transition effect on the input's before element is not working when checked? If I can't solve this issue, I might have to consider alternative solutions. input[type="checkbox"]{ width: 160px ...

Retrieve data from an API and store it in a JSON array

My website is having an issue where it's fetching data from an API and displaying it in a table, but all the cells are returning undefined values. The data in the API is structured as an array with multiple datasets inside curly braces that I am unsu ...