The combination of Bootstrap and Django does not support responsive design

My code is not working correctly, and I'm struggling to identify the errors. The website I'm working on has subpages, but the responsive design doesn't seem to be functioning properly. Could this issue be related to mistakes in my HTML/CSS code, or should I consider using a different approach for making it responsive in Bootstrap? Specifically, I've been having trouble with adjusting margins and font sizes responsively within rows and columns. Is it possible that this issue is somehow connected to Django's inheritance mechanism?

{% load static %}
<!DOCTYPE html>

<html>
<head>
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeN$
     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3$
     <link rel="stylesheet" type="text/css" href=relax/css/grid.css">

     <title>Visyrelax</title>
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <style>


   body {
background: #F8F8FF;
} /* Adding !important forces the browser to overwrite the default style applied by Bootstrap */


.row{
margin:100px;
}



@media (min-width: 576px) {

@include media-breakpoint-up(sm)

.row{
font-size:10px;
margin:10px;

}
}
@media (min-width: 768px){
@include media-breakpoint-up(sm)


.row{
font-size:20px;
margin:10%;
}
}

@media (min-width: 1200px){
@include media-breakpoint-up(sm)

.row{font-size:60px;}
p{
font-size:25px;
}
}



</style>
 </head>

<body>
    <nav class="navbar navbar-dark bg-dark">
          <a  class="navbar-brand" href ="{% url 'index'%}"> <p style="font-size:40px;"> &nbsp;&nbsp;          <font color=DodgerBlue>        Visy</font><font color$
          <div class="navbar">
               <a class= "nav-item nav-link" href ="{% url ‘a’%}”><font  color=white>a</font></a>
              <a class= "nav-item nav-link" href ="{% url ‘b’%}”><font  color=white>b</font></a>
              <a class= "nav-item nav-link" href ="{% url 'tc’%}”> <font   color=white>c</font></a>
               <a class= "nav-item nav-link" href ="{% url ‘d’%}” ><font  color=white>d</font></a>
               <a class= "nav-item nav-link" href ="{% url ‘e’ %}"><font  color=white>e</font></a>
          </div>
     </nav>

     {%block body%}
     {%endblock %}
</body>
</html>


….

{% extends 'relax/base.html' %}

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">

  <title>Document</title>
  <meta name="viewport" content="width=device-width, initial-scale =1.0">

<style>


</style>


</head>

<body>

      {%block body%}
         <br> <br><br>
       <p>  <center> <font size="40"> <b>title </b>  </font> </center> <p> <br> <br>
         <br>  <h1> <p> <center> <b> subtitle </b> <center> <br><br> </h1>

                     <div class="row">
                            <div class="col-md-5">
                                  <img src= "/media/Lesson1image.png" width="500" height="630" style="width:100%;" class="self"/> <br>


                                </div>
                             <div class="col-md-7">
                               <br> <br>

                          <p class="soft"> text


                            </p>

                            </div>


                    </div>
                    <div class="row">
                            <div class="col-md-5">

                             <h1> <p> <b> title</b> <br><br> </h1>
                             <h4>
                                  <b>text</b>: text <br><br>
                                  <a href ="{% url ‘a’ %}">Learn more</a> <br><br>
                                  <b>text</b>: text.<br><br>
                                  <a href ="{% url ‘b’ %}">Learn more</a><br><br>
                                 </h4> 
                                </div>
                             <div class="col-md-7">
                              
                            <h1><p> <b> title </b> <br><br><h1>
                           <h4> <b> text</b>: atext  <br><br>
                             <a href ="{% url ‘e %}">Learn more</a></h4> <br>
                             <br> <img src= "/media/composition.png" width="800" height="400" style="width:100%;" > <br>
                            </div>


                    </div>


              </div>
      {%endblock %}

</body>
</html>


Answer №1

If you want to ensure that certain styles are applied in your media queries, you can add !important at the end of each line. Here’s an example:

<style>
  @include media-breakpoint-up(sm)
    
    .container {
    font-size:12px !important;
    margin-top:20px !important;
    
    }
    }
</style>
    

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

Tips for Removing Padding in Material UI Container Component

I'm currently working on creating a hero banner using the material-ui framework and I've encountered an issue. Here's what I have so far: https://i.stack.imgur.com/UXTDY.png However, I'm facing an irritating problem with left and rig ...

Ways to make text within a container smoothly slide down

Hello, I have a question about jQuery as I am relatively new to it. I am currently working on creating a team members section where clicking on a team member will slide down information about that person underneath. I have managed to set up the parent co ...

Is it possible that JavaScript isn't functioning properly?

My current issue involves echoing JavaScript from a PHP file to an HTML page using AJAX. Strangely, the JavaScript does not run when dynamically echoed, even though it appears in the Inspect Element tool. On the other hand, purely textual content echoes su ...

Deactivate the rest of the buttons by utilizing the e.target.id

I have ten expansion panels. When I click a button in one expansion panel, I want to disable other buttons in the remaining expansion panels. The issue is that when I try to target an id, it does not return e.target.id but instead returns as the value pass ...

Having trouble implementing button functionality in a web app using JS, jQuery, HTML, and CSS along with an API integration

I am currently developing a web search engine that utilizes the Giphy API... However, I've encountered difficulties with the button function. I have created buttons to modify the page format and adjust the number of search results displayed.... The We ...

The outcome of data binding is the creation of a connected data object

I am attempting to link the rows' data to my view. Here is the backend code I am using: [Route("GetCarCount")] [HttpGet] public async Task<long> Count() { return await _context.Cars.CountAsync(); } ...

Implementing jQuery to showcase an element on the screen

I would like to express my gratitude to everyone who has helped me. Please forgive my poor English :) Can someone provide me with a jQuery script that can extract the name of the currently selected tab and display it in an h1 tag? Whenever the selected ta ...

utilizing javascript once form elements are dynamically inserted

While dynamically constructing form elements, I encountered an issue with generating unique IDs when the form is submitted. Everything works fine except for the JavaScript function responsible for populating the year in a dropdown selection. The issue ari ...

Alignment issues with the layout

I am facing an issue with two containers stacked on top of each other. The bottom container is wider than the top one, and both have auto margins set for the left and right sides. I want the top container to be aligned evenly on top of the bottom one. I c ...

Learn how to alter the website's overall appearance by changing the background or text color with a simple click on a color using Angular

Is there a way to dynamically change the background color or text color of the entire website when a user clicks on a color from one component to another? I know I need to use the Output decorator, but how can I implement this? style.component.html <di ...

Accessing JavaScript cookie within .htaccess file to establish redirection parameters according to cookie content

Is there a way to modify the rules within my .htaccess file so that it can properly read a user-side cookie and redirect based on its content? The scenario is this: I have a cookie called userstate which contains an abbreviation of US states, such as AL ( ...

Masonry List with Next.js Image Fill

I am encountering an issue where the normal HTML img tag works perfectly fine inside my Masonry List. However, when I use the Next.js Image Component with a layout of fill, it fails to render anything. Custom Styles: const ImageList = styled('ul&apos ...

Retrieve the URL from an iframe using Python and Selenium

On my website's main page, there is an iframe containing the text Code: LWBAD that I need to retrieve. For a clearer visual, refer to the image below: Below is the source code of my main HTML page which includes the mentioned iframe: <td class=" ...

What is causing the background image size to adjust when the carousel is toggled?

Can you help me understand why the background-image increases in size vertically when transitioning from url/path to url/path2? I need it to stay the same size as it toggles through all the images. What mistake am I making and how can I correct it? Snipp ...

Insert a div element into the JavaScript file

I have a JavaScript code snippet that needs to be inserted after the "Artwork" section. Here is the code: <div class="image-upload"> <label for="files"> <img src="ohtupload.jpg"> </label> </di ...

Enhancing the appearance of child elements using CSS modules in Next.js

My Countdown component implementation includes: import styles from "./Countdown.module.scss"; import React from "react"; import useTimer from "hooks/useTimer"; import cn from "classnames"; function Countdown({ date, ...

Tips for resizing a background image horizontally without changing its height

Having a background image that is taller than the page and setting it as the background for the wrapper has caused some issues. Resizing the window results in a large amount of white space under the background image due to the fixed height of the wrapper. ...

What is the method for adding a before pseudo-element to my button element?

HTML & CSS Issue <button>Get Postion</button> Below is the CSS code for styling a button: button { padding: 1rem; background-color: red; color: wheat; border: 4px solid yellowgreen; position: relative; cursor: pointer; ...

Adjust the font size and center alignment in the navigation bar using Bootstrap

I'm a beginner when it comes to using bootstrap and I'm having trouble adjusting the font size of my application's title. While I was able to change the color of the text, I can't seem to find where the font-size property is located for ...

Prevent selection of future dates in HTML input using PHP exclusively

I am looking for a way to limit the date input on my form using PHP and HTML. <?php echo '<input type="date" name="doc" value="' . date("d-m-Y") . '" min="11-05-2014" max="' . date("d-m-Y") . '"/>'; ?> While rese ...