The functionality of Bootstrap Cards is malfunctioning when used in conjunction with columns

When viewing on smaller devices, I want to show "Cards" in a single line -> with the image on the left and the name and description on the right. For larger devices, I prefer to have multiple cards displayed side by side -> with the picture on top and the title along with the description below.

I am satisfied with the layout of the image above the text, however, I am having trouble swapping the image position to the left and the text to the right.

This is the code I have come up with so far:

<div class='col'>
  <div class='card h-100'>
    <div class='col-4 col-md-12'>
      <img src='...' class='img-fluid rounded-start' alt='...'>
    </div>
    <div class='col-8 col-md-12'>
      <div class='card-body'>
        <h5 class='card-title'>Title</h5>
        <p class='card-text'>Description</p>
      </div>
    </div>
  </div>
</div>

Although I have set the col-4 for the image and col-8 for text correctly on small devices, they still appear one below the other instead of beside each other, and I cannot figure out why.

Answer №1

Make sure to update the class col in your first div to row. Then, arrange your card elements in columns and display them side by side on larger screens using col-md-x, col-lg-x, and col-xl-x.

Similarly, for the content within each card, group the content inside a div with the class row and organize different sections of content into columns.

For more detailed information on how to use the Bootstrap Grid System, check out the Bootstrap Grid System documentation

Here is an example structure you can follow:

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="72101d1d06010600130232475c425c40">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<div class='row'>
  <div class="col-md-4 col-12">
    ....(Structure example continues)
  </div>
</div>

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

What is the process for search engines or screen readers to extract inline tags?

Consider this scenario: the heading has normal font weight, but specific parts are written in bold. Let's look at the following example: <h1>20<span>14</span> Stack<span>overflow</span> takes over</h1> How do sear ...

CSS: concealing certain portions of an element's content

I don't have control over the following markup: <p class="filename"> <img src="http://domain.com/uploads/image_gallery/_thumbs/Chrysanthemum.jpg" alt="Chrysanthemum.jpg"> <br> Chrysanthemum.jpg </p> Is it possible ...

Concealed div obstructing access to dropdown menu

I'm having some trouble creating a dropdown menu. The submenu I've created is appearing behind my wrapper, page, and content. I've attempted to adjust the z-index of various elements and have even tried setting the z-index of my menu and sub ...

Having several horizontal scrollbars at once on a single webpage

I stumbled upon a great example showcasing how to scroll a div on my page: Check out this Codepen - https://codepen.io/zheisey/pen/xxGbEOx Although, I am looking to extend this functionality to allow multiple divs to scroll together. Any suggestions? I ...

The spacing within the HTML table appears to be sporadic and

My tables seem to be experiencing large gaps between the rows, despite setting padding and spacing to 0... The table has attributes like cellspacing="0", cellpadding="0", width="460" and border="0" However, there are still significant gaps between the ...

Using a repeating background in CSS with overflow displayed at the top rather than the bottom

Does anyone know how to make the repeating background 'start' fixed at the bottom of the div and overflow on the top? I want it to be the opposite of the default behavior. Let me illustrate what I'm trying to achieve with a small example. I ...

Use CSS to apply a gray overlay to a portion of an image

I'm attempting to add a greyed out effect to specific sections of an image (two stripes on the left and right). Is there a CSS-only solution for achieving this? I am aware that filters can be used (e.g. filter: grayscale(100%)), but I only want certa ...

Creating an XPath expression for selecting multiple siblings of a div tag

Currently, I am working on writing an XPath expression for a specific section of code: <div class="line info"> <div class="unit labelInfo TextMdB">First</div> <div class="unit lastUnit"> <div clas ...

Tips for preventing an element from scrolling horizontally along with the page body

This is the structure of my HTML: <div class='header-wrapper'> <div class='title'>Title</div> </div> <div class='some-wide-content'> </div> Let's imagine a scenario where the br ...

Adding a stylish underline to text using HTML and CSS

Looking for some assistance with my Html and CSS website project. I am currently facing a challenge trying to place a border below the text as shown in the provided image. Below is the snippet of my Html code: <div class="Sectionheading"> ...

How to set the element in the render method in Backbone?

Currently, I am in the process of developing a web page utilizing BackboneJS. The structure of the HTML page consists of two divs acting as columns where each item is supposed to be displayed in either the first or second column. However, I am facing an is ...

Accessing video durations in Angular 2

Can anyone help me with retrieving the video duration from a list of videos displayed in a table? I attempted to access it using @ViewChildren and succeeded until encountering one obstacle. Although I was able to obtain the query list, when attempting to a ...

dynamically assigning a style attribute based on the dimensions of an image retrieved from a URL

My aim is to determine whether or not I should use an image based on its dimensions. To achieve this, I came across a function on stack overflow that can retrieve the dimensions of an image just by using its URL. Here is the code snippet they provided: f ...

The button can only be edited using Internet Explorer

My webpage features a button that displays correctly in Chrome, but the text inside the button gets cut off when viewed in IE (see image). Can you provide guidance on what might be causing this issue and how to resolve it? Bootstrap version 4.0.0 is also b ...

`place the table inside a hidden div`

I am trying to create a non-editable table that can be overlayed with a div under specific conditions. However, it seems like my current implementation is not working as expected. What could be causing this issue? CSS <style type="text/css"> # ...

Angular 2 failing to display background images

I have been working on an Angular 2 app with just one component. I recently tried to set a background image for the entire page using the following code: app.component.html <dashboard class="dash"></dashboard> app.component.css .dash { b ...

Issues with maintaining the checked state of radio buttons in an Angular 4 application with Bootstrap 4

In my Angular 4 reactive form, I am struggling with the following code: <div class="btn-group" data-toggle="buttons"> <label class="btn btn-primary" *ngFor="let item of list;let i=index" > <input type="radio" name="som ...

Thymeleaf Checkbox not appearing correctly

Within my Thymeleaf templates with Bootstrap, I have successfully implemented a checkbox. Below is the code snippet used to incorporate the checkbox into the HTML templates: <td> <input type="checkbox" name="products&qu ...

Determining the specific button pressed within a Bootstrap Modal when the content includes a linked URL

I am struggling with identifying the pressed button in a modal window, particularly when the modal content is loaded from a link href. While my actual code is generated dynamically in php, I have provided a simple example below using html. It seems that w ...

Technique for updating URL when submitting a form on a webpage

I'm a newcomer to the world of coding and I have a simple issue that needs fixing. I want to create a form field where users can input the last segment of a URL provided to them. After entering this segment, I want the page to refresh automatically a ...