Pictures are not aligned at the center of the bigger card container

I am facing an issue with centering images on my cards. The containers look fine on PC (centered) when smaller, but on responsive mode they revert back to the larger size and are left aligned. I want the images in the card containers to be centered regardless of the container size.

I have attempted changing the display property from inline-block to block and using classes like "text center" and .mx-auto, but nothing seems to be effective. You can view the whole page here.

.row .heading .heading-icon {
  display: block;
}

.committee-card .card:hover {
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
  border: 0;
}

.committee-card .card {
  float: left;
  width: 100%;
  background: #fff;
  padding: 30px 20px;
  text-align: center;
  border: 2px solid #d5d5d5;
  margin: 0 0 28px;
}

.committee-card .card figure {
  width: 148px;
  height: 148px;
  border-radius: 100%;
  display: inline-block;
  margin-bottom: 15px;
}

.committee-card .card img {
  width: 148px;
  height: 148px;
  border-radius: 100%;
  display: inline-block;
}
<section class="committee-card padding-lg">
  <div class="containera">
<ul class="row">
  <li class="col-12 col-md-6 col-lg-3">
    <div class="card equal-height" style="height: 349px;">
      <figure>
        <img src="committee/001.jpg" class="img-responsive" alt="" />
      </figure>

      <h1>Richard Garwell</h1>
      <br />
      <p>Trustee and Track Committee Member</p>
    </div>
  </li>

  <li class="col-12 col-md-6 col-lg-3">
    <div class="card equal-height" style="height: 349px;">
      <figure>
        <img src="committee/002.jpg" class="img-responsive" alt="" />
      </figure>

      <h1>Glen Brown</h1>
      <br />
      <p>Trustee and Chairman</p>
    </div>
  </li>

  <li class="col-12 col-md-6 col-lg-3">
    <div class="card equal-height" style="height: 349px;">
      <figure>
        <img src="committee/003.jpg" class="img-responsive" alt="" />
      </figure>
    </div>
  </li>
</ul>
  </div>
</section>

Answer №2

To ensure the image aligns properly, simply remove the width attribute from .committee-card .card figure and the alignment settings will be applied from .committee-card .card

Answer №3

To center the cards, use the class align-items-center.

When using Bootstrap's card, the flex-direction is set to column. Therefore, to center the cards you should apply the align-items-center class. Otherwise, you would have used justify-content-center.

<div class="card align-items-center" style="width: 18rem;">
  <img src="..." class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </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

Expanding Page Width Using iPad CSS Styling

I am currently experiencing some difficulties with my webpage and its header layout when viewed on an iPad versus a desktop. Upon visiting on a computer, the images and header/footer are intended to extend 100% to the edges of the screen. However, when ...

Tips for generating a numeric whole number input field with Vuetify

After researching the topic on Vuetify's specific number input component, I am attempting to create a numeric input field. The value for both input and output is currently unknown, meaning it could be either undefined or null in order to allow cleari ...

Dear C# Tag Builder, I am looking for a way to add an attribute without a value in order

Attempting to create input checkbox HTML using Tag Builder in C#, ran into an issue trying to include the disabled field. The attribute doesn't allow null or empty values, so how can an attribute be added without a value? var builder = new TagBuilder ...

Stop users from being able to select or highlight text within a content editable div

Is there a method to develop a content-editable div where users are unable to select or highlight content, but can still input information? I'm interested in creating an interface that forces users to delete and enter data character by character, with ...

Expand the column to occupy the remaining height of the row

I've been on the hunt for a solution to this issue, but I haven't had any luck finding one. Various flexbox properties like flex-grow: 1; and align-self: stretch; have been attempted, but none seem to achieve the desired outcome. The goal is to ...

Web Security Vulnerability: Cross Site Scripting Detected

In our code, we are aiming to prevent XSS (Cross Site Scripting) attacks. However, the solution may involve a combination of JS (JavaScript) and HTML escaping, which could prove to be quite challenging. Below is a snippet that closely resembles our code: ...

Determine whether a div that has been generated automatically has been selected by the user

My JSON file contains a list of elements, each creating a container. See the code below: $.getJSON('/data/risks.json', function(data) { var html = ''; $.each(data.risk, function(key, value){ html += '<div class="elementlis ...

Unable to remove data once it exceeds 10 entries while using AJAX, jQuery, and JavaScript/PHP

I am having an issue where I can insert data into the first 10 rows and delete any of them successfully. However, when I try to insert data starting from the 11th row, I am unable to delete any rows past the 10th. UPDATE: The deletion function does not wo ...

Themes in Next.js with a splash of color

Is there a way to implement theming with color picking for elements? Check out the example here. I've explored using CSS variables and changing the document classname, but I'm uncertain if this is the best approach. @tailwind base; @tailwind com ...

At times, PHP mail usage may result in certain $_POST arrays being unexpectedly empty

I've encountered an issue while using the php mail function to send data from a html form. The mail function is functioning correctly and I receive the email upon form submission, but occasionally I receive empty arrays in the email content. Here is ...

validating API keys in Django

What is the process for verifying API keys in Django? I am currently using RapidAPI and they provide a key, but how can I authorize it with the URL? views.py def thanks(request): url = "https://webknox-trivia-knowledge-facts-v1.p.rapidapi.com/trivia/r ...

Using jQuery to update the input value when the mouse hovers over a div

Attempting to update an input value using jQuery mouseover. Situation: There are 5 divs with different colors and usernames. When hovering over a div, the input text (and background color for the color input) changes based on database values. Each time a ...

What is the method to send an email with an embedded image using C# without the presence of ATT00001.bin file

Currently, I can successfully send emails using SMTP in C# and even include images as LinkedResource. However, the issue arises when recipients receive emails with ATT0000X.bin files attached. How can I prevent these bin files from being included in the em ...

Attempting to transmit multiple variables

Can anyone provide assistance with passing multiple variables from one page to another? I am able to pass a single variable, but I need to send more than one by clicking a link. Below is a snippet of my code containing the rows I want to transmit to the ne ...

How can you tell if a contenteditable div is currently in focus?

Essentially, my setup consists of: HTML: <div class="div1"> <div class="as-text-box" contenteditable="true"></div> </div> CSS: .div1{ position:absolute; height:50px; width:200px; background:white; border:1px solid #c ...

What are some effective ways to stretch specific muscles?

I am facing an issue with my select element. The default value is "please choose," but there are options like "Accommodation & Hotels" that are longer and not clearly visible on IE browsers, though they work fine in Firefox. How can I resolve this issue? S ...

Is it possible to attach a CSS file specifically to just one React component?

Is there a way to restrict the CSS styling in my Home.js component so that it does not affect any other components? I have a separate CSS file for each component, but when I apply the styling from one file to Home.js, it ends up affecting everything else ...

Obtaining information from a database and integrating it into introjs utilizing JSON

Currently, I am using IntroJs and JSON to call the introjs. I am wondering if it is possible to store data/text/info in a database and then retrieve it using JSON? <h2 id="welcomeMsg">Welcome back,<asp:Label ID="lbl_WelcomeName" runat="server" Te ...

Differences in wrapping between IE11 and Chrome/Firefox: <DIV>

Take a look at this jsfiddle link using IE 11, Chrome, and FireFox. Here is the HTML code I am working with: <div style="width:120px;background-color:#EE1111;"> <div class="daytext"><b>27</b></div> <div class="dayitem"> ...

Creating a dynamic dashed line animation using SVG

Imagine a line growing in the same pattern as this fiddle. svg #path { stroke-dasharray: 19; stroke-dashoffset: 19; animation: dash 4s linear 0s forwards; } @keyframes dash { from { stroke-dashoffset: 19; } to { ...