Having trouble displaying the cover image properly on mobile devices using Bootstrap/MDBootstrap, facing issues with the live server as well

My project includes a cover image in .jpg format that displays perfectly on desktop, but is invisible on mobile devices. When viewed through Live Server on Vscode, the image appears at all sizes including mobile, but when hosted on Netlify and accessed from a physical phone, it doesn't show up. This inconsistency is confusing as it gives the false impression that the site is complete. The dimensions of the image are 5585 x 3141 pixels. Here's a snippet of the code I used: Mobile background/cover image. Desktop background/cover image

html,
body,
header,
#intro {
    height: 100%;
}
/* Spacing so navbar does not cover up the sections */
h2, #darkmode{
    padding-top: 60px;
}
#intro {
    background: url(../img/colorimage.jpg)no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
.top-nav-collapse {
  background-color: #24355C;
}
@media (max-width: 768px) {
  .navbar:not(.top-nav-collapse) {
    background-color: #24355C;
  }
}
@media (min-width: 800px) and (max-width: 850px) {
  .navbar:not(.top-nav-collapse) {
    background-color: #24355C;
  }
}
<!--Main Navigation-->
    <header>
        <!--Navbar-->
        <nav class="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar">

            <div class="container">

                <!-- Navbar brand -->
                <a class="navbar-brand" href="#">Navbar</a>

                <!-- Collapse button -->
                <button class="navbar-toggler first-button " type="button" data-toggle="collapse"
                    data-target="#navbarSupportedContent20" aria-controls="navbarSupportedContent20"
                    aria-expanded="false" aria-label="Toggle navigation">
                    <div class="animated-icon1"><span></span><span></span><span></span></div>
                </button>

                <!-- Collapsible content -->
                <div class="collapse navbar-collapse" id="navbarSupportedContent20">

                    <!-- Links -->
                    <ul class="navbar-nav mr-auto smooth-scroll">
                        <li class="nav-item">
                            <a class="middle nav-link" href="#intro">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#best-features">Features</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#examples">Examples</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#gallery">Gallery</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#contact">Contact</a>
                        </li>
                    </ul>
                    <!-- Links -->

                    <!-- Social Icon  -->
                    <ul class="navbar-nav nav-flex-icons">
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-facebook"></i></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-twitter"></i></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-instagram"></i></a>
                        </li>
                    </ul>
                </div>
                <!-- Collapsible content -->

            </div>

        </nav>
        <!--/.Navbar-->

        <!--Mask-->
        <div id="intro" class="view">

            <div class="mask rgba-black-strong">

                <div class="container-fluid d-flex align-items-center justify-content-center h-100">

                    <div class="row d-flex justify-content-center text-center">

                        <div class="col-md-10">

                            <!-- Heading -->
                            <h2 class="display-4 font-weight-bold white-text pt-5 mb-2">Your Name</h2>

                            <!-- Divider -->
                            <hr class="hr-light">

                            <!-- Description -->
                            <h4 class="white-text my-4">Welcome to my first project</h4>
                            <a class="btn btn-outline-white" href="#darkmode" role="button">Read more<i
                                    class="fa fa-book ml-2"></i></a>
                            <!-- <button type="button" class="btn btn-outline-white">Read more<i
                                    class="fa fa-book ml-2"></i></button> -->

                        </div>

                    </div>

                </div>

            </div>

        </div>
        <!--/.Mask-->

    </header>
    <!--Main Navigation-->

Answer №1

html,
body,
header,
#intro {
    height: 100%;
}
/* Adjusting spacing for navbar and sections */
h2, #darkmode{
    padding-top: 60px;
}
#intro {
    background: url(https://photorator.com/photos/images/kirkjufell-under-the-midnight-sun-iceland-photo-by-coolbiere-a-x-post-rsland-42750.jpg)no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
.top-nav-collapse {
  background-color: #24355C;
}
@media (max-width: 768px) {
  .navbar:not(.top-nav-collapse) {
    background-color: #24355C;
  }
}
@media (min-width: 800px) and (max-width: 850px) {
  .navbar:not(.top-nav-collapse) {
    background-color: #24355C;
  }
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<!--Main Navigation-->
    <header>
        <nav class="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar">

            <div class="container">

                <a class="navbar-brand" href="#">Navbar</a>

                <button class="navbar-toggler first-button " type="button" data-toggle="collapse"
                    data-target="#navbarSupportedContent20" aria-controls="navbarSupportedContent20"
                    aria-expanded="false" aria-label="Toggle navigation">
                    <div class="animated-icon1"><span></span><span></span><span></span></div>
                </button>

                <div class="collapse navbar-collapse" id="navbarSupportedContent20">

                    <ul class="navbar-nav mr-auto smooth-scroll">
                        <li class="nav-item">
                            <a class="middle nav-link" href="#intro">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#best-features">Features</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#examples">Examples</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#gallery">Gallery</a>
                        </li>
                        <li class="nav-item">
                            <a class="middle nav-link" href="#contact">Contact</a>
                        </li>
                    </ul>

                    <ul class="navbar-nav nav-flex-icons">
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-facebook"></i></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-twitter"></i></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link"><i class="fab fa-instagram"></i></a>
                        </li>
                    </ul>
                </div>

            </div>

        </nav>

        <div id="intro" class="view">

            <div class="mask rgba-black-strong">

                <div class="container-fluid d-flex align-items-center justify-content-center h-100">

                    <div class="row d-flex justify-content-center text-center">

                        <div class="col-md-10">

                            <h2 class="display-4 font-weight-bold white-text pt-5 mb-2">Your Name</h2>

                            <hr class="hr-light">

                            <h4 class="white-text my-4">Welcome to my first project</h4>
                            <a class="btn btn-outline-white" href="#darkmode" role="button">Read more<i
                                    class="fa fa-book ml-2"></i></a>

                        </div>

                    </div>

                </div>

            </div>

        </div>

    </header>
    <!--Main Navigation-->

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

Showcasing a single item per row in carousels on small and medium-sized devices

I have successfully implemented a Bootstrap carousel to display 3 items in a row, which is working well. However, I am looking to modify it so that only one item is shown on smaller devices such as mobiles or tablets. Can anyone assist me with this? Belo ...

A guide on extracting data from a Script element in an HTML file and saving it to a CSV file using Python Selenium

Looking for help with optimizing a Python script that extracts data from the Script tag on an HTML web page. The current output saved in a CSV file is not meeting my requirements: (1) the format is incorrect, and (2) there is unnecessary content included. ...

I'm looking to use JavaScript to dynamically generate multiple tabs based on the selected option in a dropdown menu

I'm reaching out with this question because my search for a clear answer or method has come up empty. Here's what I need help with: I've set up a dropdown titled 'Number of Chassis'. Depending on the selection made in this dropdown ...

The text is not rendering properly, with some characters being replaced by different ones

RESOLUTION: To fix the issue, eliminate font-family, font-size, and color properties from the parent div. UPDATE: The problem only occurs when I press CTRL + F5. UPDATE 2: After investigating, I found that the culprit is .site-footer with a position:abso ...

Is there an issue with this website link?

What is causing the Xul app to display the error message: XML Parsing Error: not well-formed when encountering this code snippet: <browser class="AppBar" type="content" src="test.html?img1=img1.jpg&img2=img2.jpg" flex="4"/> specifically ...

I'm currently attempting to determine the total cost of a series of operations, however, I am not receiving any results

Here is the code snippet from my HTML file: <tr> <td><input id="z1" type="number" oninput="calculateSubTotal()"> </td> <td>Shirts - WASH - Qty 1 to 4</td> <td>2.50 ea</td> ...

Ensure that when you click on the next dropdown menu opener button, the previous dropdown menu closes and only the new menu remains open

Take a look at this page first to get an understanding: On this page, I have implemented multiple dropdown menus that should open when clicked on their respective opener buttons (3 bar icon) and close either when clicked again or anywhere else on the page ...

Steps to retrieve the ID after modifying the owl carousel orientation

How can I retrieve the current id after switching sides in a slider? Currently, it only shows the previous id when there is a change. JavaScript Solution: hometopowl.on('changed.owl.carousel', function(event) { var activeMenu = $(".body-top-sli ...

How do I make an element stay in place between two other elements?

Trying to make an element "float" between two other elements using the `position : sticky` attribute. Not achieving the desired effect and unable to determine why. The goal is for the `copy` to float between the bottom of `upper` and the top of `lower`. ...

What is the method for retrieving the input text value contained within a select option?

I have encountered an issue in my HTML template where I am unable to retrieve the value within the input field upon submitting, especially if a custom category name was entered. The code includes an HTML <select> and <input> fields: {% for i ...

Aligning labels vertically with inputs

How can I align all my input fields (image) to the same vertical line? I tried using the vertical-align css property and a sass mixin I found (see below), but neither seemed to work. @mixin vertical-align($pos) { position: $pos; top: 50%; -we ...

How come the subitems of a second-level nested list do not appear when hovering over a hyperlink?

Show "News" in French when hovering over the French option. ul#topmenu li a#HyperLink:hover ul { background-color: pink; display: list-item; } <ul id="topmenu"> <li class="langHorzMenu"> <a href="#" id="HyperLink">French</ ...

Is it possible for me to create a Pomodoro clock similar to this one?

Can you provide guidance on creating a Pomodoro clock similar to this design: https://i.sstatic.net/qhd1Z.png As time progresses, the arrow should move around causing the circumference of the circle to increase. What approach or library would you recomm ...

`Prepare and load all materials in advance`

Question: On my page, I have a slideshow displaying images and videos. Before starting the slideshow, I want to ensure that all content on the page has loaded. Does $(window).load() verify if all content, including videos, has been loaded? Thanks in adv ...

Is Ursina the right choice for web development?

Looking for a method to compile Ursina for HTML5 using WebAssembly or another technology? I am seeking to make my Ursina Game compatible with Linux & Mac (and potentially Android/iOS with webview), but the current cross-platform compilation options for Py ...

The push action in NavController is not displaying Google Maps as expected

Trying to display a map upon clicking a button is proving challenging for me. It appears that the function NavController.push() does not work as expected, while NavController.setRoot() does. Despite not encountering any errors, I am unable to identify the ...

I can't seem to figure out why the removeChild() function is not functioning properly in my

Recently, I've been working on a search website where users can input either a partial or full name and then click a button to display a list of actors whose names contain that specific string in a hint-like fashion. These names are sourced from a MyS ...

What is the best method for creating a loop script within a widget using script?

I am trying to implement a loop within a widget, however, the widget contains an internal script: <!DOCTYPE html> <html><head></head><body> <script> list=["AMAR3","BBDC4", "BEEF3", "BPAN4", "BRFS3", "B3SA3", "CVCB3" ...

Text Parallax Effect

For my website, I am interested in incorporating a unique parallax effect. Instead of just fixing a background image and allowing scrolling over it, I want to apply this effect to all of the content on my site. The website consists of a single page with m ...

A CSS pseudo-class similar to :empty that disregards hidden children

Are you familiar with the :empty pseudo-class? This pseudo-class targets elements that have no children at all. But is there a way to target elements that have no visible children (excluding those with display: none)? If such a pseudo-class doesn't e ...