The Jumbotron and background images vanish as the window size transitions from full screen to smaller dimensions

Encountering an issue with my homepage: the jumbotron and background images disappear when the window size changes from full screen to small screen. However, upon resizing the window, the images re-appear. How can I make these images responsive?

Below is the current styling:

    <style type = "text/css">
       .bd-placeholder-img {
         font-size: 1.125rem;
         text-anchor: middle;
        -webkit-user-select: none;
         -moz-user-select: none;
         -ms-user-select: none;
         user-select: none;
    }

    @media (min-width: 768px) {
        .bd-placeholder-img-lg {
        font-size: 3.5rem;
        position:center;
        background-size:cover;
        background-attachment:fixed;
      }

      .jumbotron{
           margin-top:20px;
           background-image:url("{% static '9.jpg'%}" );
           background-repeat:no-repeat;
           background-size:cover;
           position:center;
           color:white;
       }

      body{
           background-image:url("{% static '8.jpg'  %}"); 
           background-repeat:no-repeat;
           background-size:cover;
           background-position:center center;
           background-attachment:fixed;
           overflow:visible;


   }

Answer №1

When working with the media query @media (min-width: 768px), it's important to remember that the styles will only be applied when the screen size is larger than 768px. To ensure the styles are consistent across all screen sizes, the styles inside this query should be moved outside of it.

<style type = "text/css">
       .bd-placeholder-img {
         font-size: 1.125rem;
         text-anchor: middle;
        -webkit-user-select: none;
         -moz-user-select: none;
         -ms-user-select: none;
         user-select: none;
    }

 
        .bd-placeholder-img-lg {
        font-size: 3.5rem;
        position:center;
        background-size:cover;
        background-attachment:fixed;
      }

      .jumbotron{
           margin-top:20px;
           background-image:url("{% static '9.jpg'%}" );
           background-repeat:no-repeat;
           background-size:cover;
           position:center;
           color:white;
       }

      body{
           background-image:url("{% static '8.jpg'  %}"); 
           background-repeat:no-repeat;
           background-size:cover;
           background-position:center center;
           background-attachment:fixed;
           overflow:visible;


   }

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

Unexpected behavior: Dropdown sidebar in Rails with JQuery closes abruptly

As I work on integrating a bootstrap theme into my rails application (https://github.com/azouaoui-med/pro-sidebar-template), I'm encountering issues with the dropdowns inside the sidebar not functioning properly. It seems to be related to a JQuery pro ...

Two headings using the same tags appear distinctively rendered

Recently, we added an iframe to our company's website that I have been helping manage. This iframe is responsible for handling requests sent to our organization. Interestingly, the headings on our website are styled using the following CSS: color: # ...

Is Material UI equipped to handle CSS Container Queries?

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries Recently introduced container queries for CSS are an exciting development. I'm curious if MUI 5.0 already supports them out of the box. It seems that the current SxProps do not in ...

Enhancing the appearance of the Switcher by framing it with

I've been working with the component package https://www.npmjs.com/package/react-switch-selector to create a design similar to this https://i.stack.imgur.com/voHqm.png Although I have made some progress, I'm struggling to add a border outline. H ...

Implementing pagination for a scrolling tab group with a flexible number of buttons

I need to implement a pagination feature in my scroll function where users can select from a list of tabs/buttons and it will automatically scroll to the corresponding div/tab. Currently, I have a while statement that generates songs from my database, with ...

How can you showcase information from the currently logged-in user in Django?

I am trying to retrieve specific data for a logged-in user to display in their profile. However, I am unsure of how to achieve this. Any hints or guidance would be greatly appreciated as I am new to building a Django project. This is my models.py: class ...

Tips for creating a Calculator with AngularJS

I am encountering issues while trying to develop a calculator using AngularJS. Below is the HTML code I have written: <!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-com ...

gallery showcasing pictures with a prominent main image and accompanying smaller images

I am struggling to display my image gallery the way I envision it. I would like to have a larger main image with the rest of the images displayed on the right side below it. The current code I have is: <div class="gallery"> <a href=" ...

What's the best way to make div columns appear closer together when floating?

Check out My CodePen: http://example.com/codepen Hello there, today I am working on a 6-column layout with 3 columns in each row. The 3rd column is quite long and resembles a sidebar. According to the design, columns 4 and 5 should be positioned close to ...

Looking for an image that spans the entire height of the container

I need help with positioning an img inside a div container that has a background color. I want the image to overlay on top of the div, extending beyond its height without causing any scroll bars. Here is a fiddle related to this issue: http://jsfiddle.net ...

Error loading jQuery: Resource couldn't be loaded due to a timeout in the request

Currently, as I work on developing a Django Webapp, I have encountered some problems with jQuery. Specifically, when using Safari as the web browser, the main webpage seems to get stuck and fails to load the jQuery source code resource from the CDN. The er ...

There was a TypeError encountered while trying to access the URL for adding a rent payment with the specific ID "1363902a-c341-4883-84ee-1

I have two models named Receipt and RentPayment. My goal is to redirect to a RentPayment form with the recently saved receipt in the receipt field when creating a new Receipt. models.py class Receipt(models.Model): id = models.UUIDField(primary_key=Tr ...

Creating custom pages and features in Django Admin

As someone who is new to working in Django, I am interested in creating two features for my web-based app that do not rely on models or database tables. The app serves as a wrapper for a Python application. The features I want to implement are: Ability ...

Maintaining duplicate values in a JSON stringify operation: Tips for retention

Server responses are being received in JSON format, which may contain objects with duplicate keys. When displaying the results, I noticed that only the last value for duplicate keys was showing up. After investigating, I realized this was due to using the ...

Generating alternate list items

I'm attempting to design a list style that resembles the one depicted in the image linked below: https://i.stack.imgur.com/U7vMw.jpg My issue is that when I try to add borders, they end up applying to the entire structure. .styled-list { list-st ...

Troubleshooting issues with the IE flexible box model functionality

Working on incorporating the flexible box model into my website has been a bit challenging. It seems to function well in webkit-based browsers like Chrome and Safari, but I'm running into issues with Mozilla, Opera, and most notably Internet Explorer. ...

How can you use JavaScript to identify resize or zoom changes across all ancestor DOM elements?

I have a DOM element that consists of a chart. <div id="plot1" class='plot-chart'></div> This specific DIV can be nested within various other DIVs. <div id="one" style="width:100%;height:100%;zoom:0.9;"> <div id="two"& ...

Displaying elements side by side on larger screens and centered on smaller screens

Is there a way to arrange elements next to each other on wider screens, aligning them left and right, while also centering one above the other on narrower screens? Preferably without using media queries: ...

Place the Share and Like buttons on a single line

I need help aligning my Facebook share button with the FB like button on my WordPress post. Despite adding both buttons on the same line, the Like button keeps appearing below the share button. I've checked in Firefox's inspector and confirmed t ...

HTML/CSS Selecting Tables: First, Last, and More

Is there a way to combine selector tags in order to style the first <td> inside the first <tr>? I have attempted various methods to merge these selectors, albeit unsuccessfully. I am simply seeking guidance on whether or not this is even possi ...