Creating a Responsive Bootstrap Card

Is there a way to make this responsive without using media queries? I'm currently working with Bootstrap cards, but when I resize the page, they overlap. I think my CSS might be causing the issue. Here is the code for both the CSS and the body. Thank you!

<style>
    /* Common Styles */
    * {
        margin: 0;
        padding: 0;
        text-decoration: none;
        box-sizing: border-box;
        outline: none;
        font-family: 'Roboto', sans-serif;
    }
    body {
        background-image: url(assets/image_bg.jpg);
        background-position: center center;
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-size: cover;
        background-color: #464646;
    }

    #image {
        padding: 17rem 15rem 0 25rem;
    }

    .card {
        width:16rem;
    }

    img {
        width:100%;
        height: 100%;
    }

</style>

<div id="image">
    <div class="row">
        <div class="image-column col-lg-3 col-md-6 col-sm-6">
          <div class="card h-100">
            <div class="card-header">
              <h3>GABEL LOFFEL</h3>
            </div>
            <div class="card-body p-0 w-100">
              <img src="assets\image_1.jpg" alt="">
            </div>
          </div>
        </div>
  
        <div class="image-column col-lg-3 col-md-6 col-sm-6">
          <div class="card h-100 p-0">
            <div class="card-header">
              <h3>GARY GARI</h3>
            </div>
            <div class="card-body p-0 w-100">
                <img src="assets\image_1.jpg" alt="">
            </div>
          </div>
        </div>
        <div class="image-column col-lg-3 col-md-6">
          <div class="card h-100 p-0">
            <div class="card-header">
              <h3>IL PIATTO</h3>
            </div>
            <div class="card h-100 p-0">
                <img src="assets\image_1.jpg" alt="">

            </div>
          </div>
        </div>
        <div class="image-column col-lg-3 col-md-6">
            <div class="card h-100 p-0">
              <div class="card-header">
                <h3>PIERRE PLATTERS</h3>
              </div>
              <div class="card h-100 p-0">
                <img src="assets\image_1.jpg" alt="">

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

Answer №1

To adjust the layout, eliminate padding for #image and change the width of the card from 16 rem to 100%. If you are utilizing bootstrap classes for widths (such as col-lg-3 col-md-6), refrain from specifying a fixed width for the card. If adjustments are necessary, make use of percentages instead.

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

Incorporate Bootstrap 4 SASS into ASP Core Project to customize base font size

My journey began with a desire to adjust the base font-size of Bootstrap 4. After some investigation, I learned that overriding the variables in the _custom.scss file was the recommended approach, so I set $font-size-root: 14px. Everything seemed to be goi ...

Is there a way to automatically remove a video using JavaScript once it has completed playing?

This is my HTML section: <section id ="information"> <video id ="videoName" width="800" height="400" controls onplay="myAnimationPicture()""> <source src="video/videoName.mp4" ; type="video/mp4"> Your browser does not support the ...

Siblings mousedown event propagation

In my HTML code, I have a division that contains multiple image objects with the position set to absolute. Here is an example: <div> <img> <img> <img> <img> </div> The problem arises when the ...

The text in the image caption has been drastically reduced along with the size of the image

Currently, I am dealing with the following code: <div style="min-width: 1000px;"> <p> Some text </p> <div class='div_img_left'> <img src="images/sth.png" alt="missing image" style="max-width ...

Chakra UI is providing an incorrect font style

I recently attempted to incorporate the M Plus Rounded 1c font into my project by following the guidance provided by Chakra UI on using custom fonts (link: https://chakra-ui.com/community/recipes/using-fonts). However, I encountered an issue where Chakra U ...

Incorporating Copyleaks SDK into Angular: A Seamless Integration

Currently, I'm in the process of implementing the Copyleaks SDK with Angular to conduct plagiarism checks on two text area fields within an HTML form. Within the form, my goal is to incorporate two buttons: one to check for plagiarism on one text area ...

Styling and Script Files on a JQuery Mobile Website

Is it necessary to include CSS and JS files in every HTML page for a mobile site developed with JQueryMobile? <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> <script src="http://code.jquery.com/jqu ...

Issue with the overall HTML design

The placement of the banner is exactly where I want it to be, however, the boxes using jQuery masonry are overlapping it. I'm not sure what I did wrong here. Any suggestions or insights on how to fix this issue? Example HTML Code: <script type="t ...

Bootstrap: Problem arises when columns do not total up to 12 and are pushed onto separate rows

So, I've been working with Bootstrap to structure columns and rows. It seems like I have the container, rows, and columns set up correctly for each post. However, I am puzzled as to why a new row is created for every post I make, causing them to stack ...

Pictures on aspx websites utilizing a Master Page

On my master page, I have two images - a logo at the top and a Facebook link at the bottom. There is also an admin folder containing .aspx pages specifically for admin logins. For all non-admin pages, the images are accessed using the src of image/logo.jp ...

Adjusting the border-right size based on scroll position

Apologies if this question seems trivial, but I am completely new to coding in HTML and JavaScript. I understand that I can make some changes based on scroll position, but right now I'm a little confused. I want to increase the height of a box as the ...

Encountering a problem with React components displaying incorrect sizes while utilizing flexbox styling

I am creating a basic test application using NextJS/React. Take a look at the code snippet below: The content of Board.tsx file: import './Board.css'; export default function Board() { return <div className="board"> < ...

Using Javascript to change CSS in a Polymer application

Coming from a background in angular and react, I am now delving into the world of polymer. I have a polymer class called myClass with the following template. <div id="[[x]]"> Here, 'x' is a property defined in a property getter. stat ...

Repeating nested items

I'm experiencing difficulty with repeaters. I'm attempting to display a list of appliances under unique categories from my database. The category names repeat correctly, but the appliance names are repeating for all categories (meaning all catego ...

Is it possible to alter CSS attributes dynamically without setting a limit on the number of changes that can be made?

In my current project, I am looking to add a feature that allows users to choose the color scheme of the software. While the choices are currently limited, I plan to implement a color picker in the future to expand the options available. So far, I have ex ...

Ensure the date is displayed in the format of dd-mm-yyyy when using the input type=date

Here is the code I am currently using : <input type="date" class="form-control" id="training_date" name="training_date" placeholder=" select" value="" onfocus="(this.type='date')" onfocusout="(this.type='date')" max=<?php echo ...

Updating Loader on Button Press in Bootstrap 4.4: Switching or Concealing Spinner Post-Loading

After searching through various questions related to this topic, I have yet to find one that specifically tackles what I'm looking for with the latest Bootstrap version 4.4. Before we go any further, please take a look at this fiddle: https://jsfiddl ...

Can I use jQuery to disable all elements within a div, including anchor and paragraph tags?

Can anyone offer assistance with HTML and CSS? I am trying to disable all content inside a div that has the class "main-wrapper" when a user clicks on a logout button using a jQuery function. I have attempted two methods, but so far without success! funct ...

How to conditionally prevent event propagation to children in VueJs

This Vue component is called ColorButtonGroup, and it serves as a group of checkbox/toggle buttons. It has a maximum limit of 4 colors that can be selected. The component utilizes another component called ToggleButton, which is a simple toggle selection w ...

Formatting a specific portion of the content within the placeholder

I need to adjust the CSS style for a specific part of a placeholder, not the entire placeholder text. For example, if my placeholder text is: "Where (example: New York)" <label>Search:</label> <textarea placeholder="Where (example: New Yor ...