How come the Bootstrap 4 column is not utilizing its entire available width?

My webpage is structured as follows:

<div class="container">
  <div class="row mb-5">
    <div class="col-12 col-md-3">
      <img class="mr-5 img-fluid" src="big_icon_1.png" alt="Big icon 1">
    </div>
    <div class-"col-12 col-md-9">
      <h3 class="mt-0 mb-1 text-center text-md-left">Item 1</h3>
      <p>This is item 1.</p>
    </div>
  </div>
  <div class="row mb-5">
    <div class="col-12 col-md-3">
      <img class="mr-5 img-fluid" src="big_icon_2.png" alt="Big icon 2">
    </div>
    <div class-"col-12 col-md-9">
      <h3 class="mt-0 mb-1 text-center text-md-left">Item 2</h3>
      <p>This is item 2.</p>
    </div>
  </div>
</div>

I have set up my layout to display a column structure from the 'md' breakpoint onwards, and a stacked layout below that. However, I am facing an issue where the second column does not extend to the right edge of the parent 'row' container. This behavior is contrary to what I expected based on Bootstrap documentation examples.

The image column displays correctly with a width of 1/4 row on desktop and full width on mobile. But the column containing the heading and text only stretches to fit its content, regardless of screen size. This results in the centering of the heading being ineffective.

I am puzzled by this unexpected behavior. Can anyone help me understand what I am missing?

Answer №1

While browsing through this website, I noticed a small error that went unnoticed by the source formatter. Interestingly, my source editor has such a subtle color difference that I failed to spot it:

<div class-"col-12 col-md-9">

The correct code should be:

<div class="col-12 col-md-9">

I think it's time for me to change my editor's color scheme.

Interestingly, the line in question doesn't actually require the col-12 class. I added it out of desperation.

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

Creating a centered transparent rectangle of a specific width using HTML

I am working on a page layout similar to this FIDDLE body { margin:0 auto; max-width: 800px; padding:0 0 0 0; text-align:left; background-color:#FFFFFF; background-image: url('http://freeseamlesstextures.com/images/40-dirty-pa ...

How can the <dfn> tag be effectively utilized?

Even after studying the syntax and application of this tag on MDN, in a book, and various other sources, I am still struggling to see its practical significance. Maybe it's beneficial for search engine optimization? ...

Ways to access the value of an input field using Javascript

I am currently utilizing the valums-file-uploader plugin for file uploads via ajax. However, I have encountered an issue with its functionality. Below is the script that I am using: <input type="text" id="Gaurav" name="Gaurav" /> <script src="fil ...

Every time an input field is clicked, an email is sent

I'm struggling with the contact form on my website. Instead of sending an email after clicking on each input field, I want it to send only one email after hitting the submit button. Currently, it sends a total of 5 emails - 1 with user inputs and 4 wi ...

Leveraging the select class in Flask

In my Python application, I am trying to extract the selected value from an HTML/JavaScript form. Below is the snippet of my HTML code: {% block content %} <form method="post"> <div class="form-group"> <label f ...

What is the best way to extract inner HTML content using Regular Expressions?

<div class="colmask"> <h1 class="continent_header"><a name="US"></a>US</h1> <div class="colmid"> <div class="colin"> <div class="colleft"> ....... ....... ...

An External Force is Disrupting My Jquery

Something seems off because everything was working perfectly fine until the FallingLeavesChristmas.min.js file stopped activating on this specific page. I initially thought it was an issue with the JavaScript itself, but that doesn't seem to be the ca ...

Transmitting the identification number of a post with the help of J

I am currently working on a while loop in PHP that fetches associated results from a query and displays them within a class identified by the user who created the post. My goal is to send the id of the class to PHP, similar to how I am sending the num vari ...

Ways to prevent browser scrolling on smartphones and tablets

Having a simple HTML file with an iframe embedded, I have been attempting to prevent my browser from scrolling in both documents. However, this solution works intermittently and does not provide consistent results. I have tried applying various event list ...

What is the best way to set a specific image as the initial image when loading 'SpriteSpin'?

I'm currently working on creating a 360-degree view using the SpriteSpin API. Everything is functioning as expected, but I have an additional request. I need to specify a specific image to be the initial landing image when the page loads. The landing ...

What is the method for distributing additional width in a table among its columns?

Have you ever wondered how excess space in an HTML table is distributed among the columns? I too was curious about this, but couldn't find a definitive answer even after extensive searching. Therefore, I decided to create a simple test page to investi ...

How can we evenly distribute buttons in Bootstrap 4 while also ensuring they are vertically aligned?

When attempting to generate buttons using the code below, I encountered issues with the buttons not spreading across the container as expected after using the btn-block class. Additionally, the buttons did not center-align, despite using the justify-conten ...

Guidelines for Inputting Passwords in Bootstrap 4 Modal Windows

$(window).on('load',function(){ $('#loginModal').modal('show'); }); $(document).ready(function(e) { $('#loginModal').on('hidden.bs.modal', function(e) { window.location.href = '../index. ...

Execute a function on each item within a JavaScript array

I'm working with a JavaScript array and trying to figure out how to display each item in the array within an h1 element. Can anyone help me out? This is what I have come up with so far: names = ["Jeff", "Steve", "Bill"]; function show() { let c ...

The Semantic-UI Dropdown does not appear when utilizing the sidebar feature

Is it normal for a dropdown in the pusher not to show when using a sidebar? I tried setting overflow-visible but it didn't work. Any suggestions on how to resolve this? Check out this JSFiddle example: https://jsfiddle.net/3djmjhn5/1/ Code: $(&ap ...

Incorporating dynamic HTML content into a Bootstrap 2.3.2 popover

I'm trying to create a dynamic Bootstrap popover with HTML content when hovering over a button. Here's what I have so far: $(".btn.btn-navbar").hover(function() { html = '<ul class="nav"><li><a href="#">hello</li>& ...

What steps should I take to ensure that the buttons on my restaurant website are correctly displaying the overlays?

I'm currently facing an issue with the functionality of the buttons on my React.js-powered restaurant website. These buttons are located within a component called MenuButtons.jsx and are situated at the bottom of a shorter menu section on the homepage ...

Which JavaScript files should be included when using Jquery's Round corner plugin?

Can anyone provide me with a comprehensive list of files required for utilizing the round corners plugin in jQuery? Also, I'm interested in learning how to incorporate the plugin's functions into my JavaScript code. My goal is to implement rounde ...

How can I resolve the recurring multiValueDictKey Error in my Django/Bootstrap project?

Below is the login form code: <form class="user" action="/returningAgent/" method="post" > <div class="form-group"> <input type="email" class="form-control form-control-user" id= "InputEmail" name="InputEma ...

The JavaScript functions that are being called from an external JS file using a <script> tag are showing an error message stating they are "undefined"

UPDATE: Check out my response below as the issue has been resolved :) Just a heads up, I've only recently started diving into JavaScript and JQuery, so there might be something simple that I'm missing. Despite browsing through numerous similar q ...