IMAGE CARDS WITH BOOTSTRAP 5

I created a bootstrap card with an image on the right side, but it doesn't fill the entire space. Below is the image of my bootstrap card:

https://i.sstatic.net/k7xuT.png

This is the code for my card:

{% for book in thesis_details %}
                        <div class="card m-3" style="border: 1px solid blue;">
                          <div class="row g-0">

                            <div class="col-md-4">  
                                <div class="card-image">
                                {% if book.image_banner %}
                                    <img src="{{book.image_banner.url}}" class="img-fluid rounded-start" alt="...">
                                {% else %}                      
                                    <img src="{% static 'images/placeholder.png' %}" class="img-fluid rounded-start" alt="...">
                                {% endif %}
                                </div>
                            </div>

                            <div class="col-md-8">  
                              <div class="card-body">
                                <h2 class="card-title">{{book.title}}</h2>
                                <h6 class="card-subtitle">Published by: {{book.author}}</h6>
                                <h6 class="card-subtitle pt-1">Course: {{book.course}}</h6>
                                <p class="card-text">{{book.abstract|safe|slice:":310"}}...</p>
                                <a href="/view_studthesis/{{book.thesis_id}}"><button class="btn btn-outline-danger float-bottom" style="">View more</button></a>
                              </div>
                            </div>

                          </div>
                        </div>
                    {% endfor %}

Here is the CSS for my card:

/* for cards */
.card{
  border: 1px solid blue;
  font-family: 'Outfit', sans-serif;
}

.card-image{
  width: 100%;
  height: 250px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.card-image img{
  object-fit: 100%;
  min-width: 100%;
  min-height: auto;
}

Answer №1

your CSS currently reads: .card-image{ height: 250px; }

In my opinion, it would be better to use: .card-image{ height: 100%; }

by using a relative height value instead of a fixed one.

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

When pressing the next or previous button on the slider, an error message pops up saying "$curr[action] is not a

I found this interesting Js fiddle that I am currently following: http://jsfiddle.net/ryt3nu1v/10/ This is my current result: https://i.sstatic.net/VygSy.png My project involves creating a slider to display different ages from an array, such as 15, 25, ...

Tips for inserting a personalized image or icon into the ANTD Design menu

Can anyone help me figure out how to replace the default icons with a custom image or icon in this example: https://ant.design/components/layout/#components-layout-demo-side I attempted to do it by including the following code: <Menu.Item to="/" key=" ...

Revamp responsiveness in bootstrap 3 for printing with @media queries

My goal is to disable the responsive features of bootstrap when the event javascript:print() is triggered. This way, I want my webpage to maintain the column grid layout that I have defined, regardless of screen size. One solution suggested in this answer ...

Issue with Vuetify carousel not resizing to fit the entire width and height

I am looking to create a carousel that spans the entire width and height of a viewport in my Vue.js 2 project using Vuetify. Below is the code I have so far: <head> <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500, ...

HTML5 footer element is the perfect way to add a

I'm currently working on creating a footer that stretches across the entire width of the screen. Originally, I had it nested within the body tag which was centered with a width of 825px. To remove this width constraint, I moved the footer under the ht ...

Styling in Svelte/TS does not change when applied through a foreach loop

I've been experimenting with creating a unique "bubble" effect on one of my websites, but I'm facing difficulty changing the styling in a foreach loop. Despite no errors showing up in the console, I'm at a loss as to how to effectively debu ...

Is there a way to move my (bootstrap) elements to the bottom of the columns without using position absolute?

I'm currently working on 3 columns with icons at the bottom, as seen on the bottom of this website: I'm trying to align the icons directly to the bottom of each grey box without relying on position absolute which is what I'm currently using ...

Tips for successfully sending a nested function to an HTML button and dropdown menu

I'm working on two main functions - getChart() and fetchData(). The goal is to retrieve chart data and x/y axes information from a database. Within the getChart function, I'd like to incorporate a dropdown menu for displaying different types of c ...

Tips for inserting a placeholder into a form input field

I am currently working on developing a form displayed in this fiddle. My goal is to fit an entire placeholder text into the form. Here is the HTML I've used to create a compact input form: <div class="container text-center "> <div class= ...

In search of a regular expression for identifying any of several classes

In the process of upgrading all my websites, I decided to redesign them so that all URL's default to lower case. This meant changing all image names and paths to lower case as well, which was accomplished using regexes. However, this action inadverten ...

Is it possible to use font-face in CSS3 to switch fonts for different languages?

Can I replace an Arabic font with a custom one using font-face in CSS3? I've successfully done it with English but I'm not sure if it's the same for foreign languages, so I wanted to check. Also, I feel silly asking this question, but I&apos ...

PHP does not provide any error when an update on a database row fails

When I try to update values retrieved from the database into a form on submission, the process fails without any error message. Below is the PHP code snippet: <?php session_start(); $username=$_SESSION['uname']; $cn=mysqli_connect("loc ...

`The problem of div width error``

I am trying to display two divs side by side with a width of 50% each. Below these two divs, there is another div with a full width of 100%. Check out my code below: <div class="col_1_2"></div> <div class="full-description">description& ...

How can TailwindCSS be used to wrap a nested flexbox at a specific viewport?

Utilizing TailwindCSS, I have the following code snippet: <div class="box-border flex w-auto flex-row gap-2 rounded-2xl border p-4 my-4 mx-4"> <div class="grow-0"> <div class="flex h-full flex-col items-center ...

Can PHP be used to dynamically load a different stylesheet on a webpage?

Currently in the process of developing a mobile version of my website, I have determined that implementing an alternate stylesheet would be the most effective method to ensure compatibility with mobile devices. I am considering using a PHP script for use ...

JavaScript combined with a dynamic menu, a customized current link style using CSS, and a site built on PHP

Here's my current website setup: My website is modular and uses dynamic inclusion. The header is a crucial part of the main page, which is responsible for displaying content from specific links on the site. External links to CSS and js files are incl ...

My custom Material UI table is being hindered by unnecessary div tags that are interfering with my CSS styling

View the generated code The rendered table demonstrates that when scrolling past the maximum width, the data does not appear <div> <table (not going to display all the markup for this. this table contains the headers of each column and appear ...

CSS following a clicked event

http://codepen.io/anon/pen/GqmEAq My goal is to make the 'x' button clicked (the 'x' is created after clicking the plus sign on the menu) and then bring the dropdown back up. I have attempted: a:after:checked ~ .submenu{ max-height ...

Aligning a lowercase "i" element within a container

Is there a more effective way to center the "i" element within this div without using specific pixel margins that adjust based on hover? Below is my code snippet: HTML: <div class="nav-collapse"> <i class="fa fa-bars fa-2x" id="bars"></ ...

The background color in CSS frames the text with a unique hue

Is there a way to wrap my multi-line text inside a div with a background color that automatically adjusts its size based on the text length? .multiline{ padding:0px; white-space: pre-wrap; height: 100px; width: ; margein:0px } <div style="b ...