Creating a dynamic and adaptive layout using Bootstrap 4

Currently, this webpage appears as follows: I attempted to organize the images in row 2 of the grid but the outcome was reversed

Upon resizing to a mobile screen and switching to a flex column layout: I tried to address the overflow issue

The HTML code:

<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Bootstrap 4 Responsive Layout Example</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="07776877776275296d7447362936312937">[email protected]</a>/dist/umd/popper.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</head>

<body>
  <div class="row">
    <div class="col-md-12 col-lg-4 col-xl-5">
      <h2>PROTECT YOUR BUSINESS WITH OUR NHS ASSURED FACE VISOR</h2>
      <p>Designed with care and comfort in mind</br>
        Our innovative face visor is designed with care, comfort, and personalization in mind. Developed specifically to help during COVID-19, you can be assured of a product that meets NHS standards, protecting your business, staff, and yourself.</p>
      <p><a href="https://www.tutorialrepublic.com/html-tutorial/" target="_blank" class="btn btn-success">Learn More &raquo;</a>
        <a href="https://www.tutorialrepublic.com/html-tutorial/" target="_blank" class="btn btn-success">Learn More &raquo;</a></p>
    </div>
    <div class="col-md-6 col-lg-4 col-xl-3">
      <img src="img/3-layers.png">
    </div>
  </div>
  <div class="row my-5">
    <div class="col-md-12 col-lg-4 col-xl-5">
      <h2>OUR UNIQUE RAMFOAM CARE PROCESS IS AS SAFE AS OUR VISOR</h2>
      <p>We can fully brand your face visor to match your company colors and deliver hundreds of thousands of visors to you safely and securely. Our process ensures safety and involves creating a comfortable, adjustable, and reusable PPE item including
        a medically approved hypoallergenic foam headpiece with a fully replaceable anti-fog visor system delivered in two pieces for easy storage and self-assembly.</p>
    </div>
  </div>
  <div class="row mb-5">
    <div class="col-md-6 col-lg-4 col-xl-5">
      <h2>PROTECT YOUR BUSINESS WITH THE BEST IN THE BUSINESS</h2>
      <p>Receive your visors within five working days. Our innovative face visor is designed with care, comfort, and personalization in mind. Developed specifically to help during COVID-19, you can be assured of a product that meets NHS standards, protecting
        your business, staff, and yourself.
      </p>
      <p><a href="https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/" target="_blank" class="btn btn-success">Learn More &raquo;</a>
        <a href="https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/" target="_blank" class="btn btn-success">Learn More &raquo;</a></p>
    </div>
    <div class="col-md-6 col-lg-4 col-xl-5">
      <div class="card bg-default">
        <div class="card-body">
          <h4 class="text-center text-uppercase my-3">contact sales</h4>
          <p class="text-center mb-4">Please drop us an email through the form below, and we'll be in touch within 24 hours.</p>
          <form role="form">
            <div class="form-group">
              <input class="form-control" placeholder="NAME" type="text">
            </div>
            <div class="form-group">
              <input class="form-control" placeholder="EMAIL" type="email">
            </div>
            <div class="form-group">
              <input class="form-control" placeholder="PHONE" type="number">
            </div>
            <div class="form-group">
              <textarea class="form-control textarea-custom" rows="3" placeholder="MESSAGE"></textarea>
            </div>
            <div class="form-group">
              <button class="btn btn-light text-right text-uppercase" type="button">submit</button>
            </div>
          </form>
        </div>
      </div>

    </div>
  </div>
</body>

</html>

I attempted to customize the Bootstrap template, and after saving the code, I encountered an overflow issue (non-responsive)

Answer №1

Check out this example, it's the most basic version.

<html>
...
<body>
     <div class="container">
          <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">...</div>
          </div>
          <div class="row">
              <div class="col-md-4 col-sm-4 col-xs-4">...</div>
              <div class="col-md-4 col-sm-4 col-xs-4">...</div>
              <div class="col-md-4 col-sm-4 col-xs-4">...</div>
          </div>
     <div>
</body>
</html>

You might also want to explore the distinctions between container and container-fluid in Bootstrap, as well as the concept of row and col. It's a fairly straightforward idea.

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

I'm finding it difficult to decide which comparison operators to utilize for my JavaScript game. Experimenting with both the "&&" and "||" options has left me unsure of which

In this scenario: If the user enters a number in the text box, such as 2 (paper) or 3 (scissors), the "ComputerChoice" will randomly generate a number between 1 and 3. The goal is to make the computer understand and react to different scenarios... For exa ...

Tips for adjusting the maximum width and content-based width for columns within an HTML/CSS table

I'm working on a simple HTML/CSS code featuring a container with two adjustable slots, controlled by a handler in the middle to modify the space each slot occupies. The first slot contains a table with fixed columns, automatic columns, and limited col ...

The socket.on() function is not able to receive any data

I am encountering an issue with implementing socket.on functionality $('#showmsg').click(function() { var socket = io.connect('http://localhost:3000'); var msgText = $('#msgtext'); socket.emit('show msg', msgText.va ...

Automated service worker upgrade procedure

Currently, I have some concerns regarding the update process of the service worker used in my project. Within this project, there are two key files associated with the service worker: The first file, "sw.js", is located in the root of the website and is i ...

What is the best way to send information from one screen to a flatlist in React Navigation?

Currently, I am retrieving data from an API in the form of a JSON file. My goal is to pass this data from the main app to the appStack and then to the sessionsStack before displaying it on the home page. However, my console logs indicate that the data only ...

Is there a way to reverse the hover effect on div elements?

Let's start by examining the code I've written: HTML: <div class="button_container"> <div class="inner_button"> <a href="#" class="button_text">Button</a> </div> <div class="button_side"> ...

Generate pre-set components using fundamental building blocks

Can I predefine some props for components? In my Vuetify example, let's say I want to customize the v-btn component with specific props. This custom implementation would act as a child component while still providing all the functionalities of the par ...

Exploring the power of React Leaflet and the exciting possibilities of React Leaflet

I'm currently in the process of implementing the draw functions on a leaflet map. I started off by creating a new app with just react-leaflet installed. I used npx create-react-app and installed the following packages: npm install react react-dom lea ...

I'm trying to figure out how to resolve this issue in IE: SCRIPT1003: A colon is expected

let dataOptions = { @foreach($options as $option) @if($option->option_type == 0) Choose_{{ $option->id}}, @endif @if($option->option_type == 1) ...

I have chosen not to rely on Media Query for ensuring responsiveness in my Angular 2 application, and instead opted to utilize JavaScript. Do you think this approach is considered a

I am in the process of ensuring that my app is fully responsive across all screen sizes. Instead of relying on Media Query, I have chosen to use JavaScript with Angular 2 to achieve this responsiveness, utilizing features such as [style.width], *ngIf="is ...

Web scraping with Cheerio in Node.js sometimes yields undefined results

When attempting to extract data from NSE website, I initially tried using the inspect element console: (Edited the question) https://i.sstatic.net/Xq8mZ.png objs = $('div[class="table-wrap"] > table > tbody > tr > td').slic ...

"Learn how to use jQuery to retrieve a specific row from an HTML table based on equality with a certain

I have a dynamically generated table using PHP. The information in this table is related to different semesters (such as first, second, third, etc.). I want to display specific semester information when a user clicks a link from the same table without need ...

Implementing jQuery form.js to dynamically update image src upon success

I am currently utilizing jquery.form.js to submit a form via AJAX and retrieve a response. My PHP page is configured to output the image URL in the format "images/thumbs/071112130957.jpg" Below is my jQuery code: $("#imageform").ajaxForm( { target: &ap ...

Is your Node.js HTTP Request failing to function properly?

I am currently working on creating an HTTP Request function where all requests are directed to the same domain but with different file names. Unfortunately, I am encountering a problem where nothing is being displayed in the console and no data is being r ...

Using MongoDB Object as middleware in Express applications

I’m facing issues trying to access the "DB" database object that gets created when the MongoDB client module establishes a connection with my MongoDB database. Currently, I am encountering an error indicating that in data.js, 'db' is not defin ...

Updating data in MongoDB with an expiration feature

Despite setting the expireAfterSeconds option to 60 in my Mongodb shell, my new entries in the unlock schema are not being deleted after 60 seconds. db.unlocks.ensureIndex( { "createdAt": 1 }, { expireAfterSeconds: 60 } ) Here is the structure of my Sche ...

Encountered an issue while trying to register a service worker: "[ERROR] Cannot import statement outside

With the utilization of register-service-worker, the boilerplate for registerServiceWorker remained untouched. /* eslint-disable no-console */ import { register } from 'register-service-worker'; if (process.env.NODE_ENV === 'production&ap ...

Center align content on small screens using Bootstrap 4

Here is a simple Bootstrap 4 row example: <div class="container"> <div class="row"> <div class="col-md-12 p-2"> <img class="" src="../assets/img/Logo-small.png" alt=&q ...

What effect does the addition of a border-top have on the position of the left column, causing it

Currently, I am working on creating a list with each list item having a bottom border of 1px solid. The list is then divided into 3 columns using column-count:3 CSS property. For instance, if there are 8 items, it should display 3 items in the first column ...

Unable to transfer the function's output to a variable

This is a code snippet relating to an object Obj.prototype.save = function (fn){ var aabb = Obj.reEditName(this.name, function(newName) { return newName; // Additionally attempted var foo = newName; return foo; ...