When transitioning to mobile size, I aim to maintain the consistent design of my background-color circle using Bootstrap 5

I am working on creating a card design with a colored background instead of an image. However, I am facing an issue where the rounded-circle background color changes to an ellipsoid shape after passing the mobile size (sm or xs).

Here is what I am aiming for:

My goal is to maintain the same design across xl-md-sm and even for xs. I tried using @media query to solve this problem but unfortunately, it did not work as expected. Therefore, I need your assistance.

This is the current outcome:

Below is the HTML markup:

<div class="container mt-5 mb-4 px-5">
<div class="card ">
  <div class="row mt-5 w-100 hover-shadow ">
    <div class="meq card-body bg-danger .d-sm-flex col-2 mt-0 mb-0 rounded-circle px-sm-0 ">
      <h1 class="nowrap text-center text-light font-weight-bold px-sm-2 py-5">KKE</h1>
      <a href="#!">
      </a>
    </div>
    <div class="col-10 second_part">
      <div class="card-text justify-content-center align-items-center">
        <div class="card-body">
          <a href="#" class="list-group-item-action">
            <div class="d-flex w-100 justify-content-between">
              <h3 class="mb-1 text-dark font-weight-bold">Kumbu<br> Kumbu<br>Ezechias</h3>
              <small class="text-muted">
                <ul class="list-group">
                  <li>
                    <div class="progress ">
                      <div class=" progress-bar bg-danger" role="progressbar" style="width: 100%;"
                        aria-valuenow="100" aria-valuemin="100" aria-valuemax="100"></div>
                    </div>
                  </li>
                  <li> Dear you won</li>
                  <li><small class="font-weight-bold align-content-center float-right">Mo 20224525</small>
                  </li>
                </ul>
              </small>
            </div>
            <p class="mb-1">
              Xxxxx77
            </p>
            <p class="mb-1">
              04:25
            </p>
          </a>
        </div>
      </div>
    </div>
  </div>
</div>
<!--/ card 1 -->

And here is the CSS code:

    * {
  margin: 0;
  padding: 0;
  initial-letter-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

h1,
h3,
h6 {
  text-transform: uppercase;
}

ul {
  margin-left: -10px;
  padding-left: -10px;
  list-style: none;
}
h6 {
  text-align: end;
  margin-top: 70%;
  margin-right: 37%;
}
.nowrap {
  white-space: nowrap;
}

@media (max-width: 48em) {
  h1,
  h3 {
    font-size: small;
    font-weight: normal;
  }
  h1 {
    margin-top: 0%;
    text-align: center;
  }
  div .meq {
    top: 50%;
    text-align: center;
    max-height: 10.1rem;
    max-width: 10.1rem;
    padding-left: 0.7rem;
    padding-right: 1.9rem;
    position: relative;
    border-radius: 100%;
  }
  * {
    margin: 0;
    padding: 0;
    initial-letter-align: center;
    text-decoration: none;
    box-sizing: border-box;
  }
}

Answer №1

In my opinion, the issue arises from the classes .d-sm-flex and card-body that you are using. Here is a revised suggestion for your circular div:

<div class="rounded-circle text-center" style="width: 10rem; height: 10rem; background: blue;">
      <h1 class="nowrap text-center text-light font-weight-bold px-sm-2 py-5">ABC</h1>
      <a href="#!">
      </a>
    </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

Optimizing the position of the datepicker dropdown in Boostrap 4

I am currently utilizing Bootstrap 4 (final) with the boostrap-datepicker-plugin 1.7.1. Since Bootstrap 4 no longer uses .input-group-addon elements for the calendar icon, but instead .input-group-prepend and .input-group-append, I made some modificatio ...

As the page is scrolled upwards, the custom cursor's location shifts accordingly

In developing a custom hover cursor for my video div, I am encountering an issue where the cursor does not move with my mouse and remains in place when I scroll. Could someone please review my code and identify what I am doing wrong? Additionally, I have ...

What is the best way to incorporate a CSS transition without any dynamic property changes?

Is there a way to add a transition effect to a header when its size changes without a specified height value in the CSS? The header consists of only text with top and bottom padding, so as the text changes, the height adjusts accordingly. How can I impleme ...

"Discover the magic of creating a navigation menu with jQuery toggle - let me show

Recently, I managed to create a side navigation using the target function in CSS3. However, I am curious about how I can achieve the same result using jQuery without disrupting the layout. Any assistance would be greatly appreciated. Here is the code sni ...

The Ng-include tag does not provide highlighting for its text

Within an ng-include template, I have a div that is not highlighting when hovered over. Although the cursor changes to a pointer when hovering over the text, attempting to click and drag to highlight it results in nothing happening. This issue is signific ...

JQuery isn't functioning properly on dynamically generated divs from JavaScript

I'm currently tackling an assignment as part of my learning journey with The Odin Project. You can check it out here: Despite creating the divs using JavaScript or jQuery as specified in the project requirements, I am unable to get jQuery's .hov ...

Challenge with the desktop sidebar in a responsive design

Disclaimer: Seeking input on how to address this issue kindly suggest another title for editing Situation I have a responsive design layout for mobile and desktop with different blocks: Mobile | block1 | | block2 | | clientInfos | | eq ...

Change the marquee scrolling back to its original starting point

I am trying to implement a continuous image scroll (marquee) in HTML. My goal is to have the marquee stop scrolling when the mouse hovers over it, with the images returning to their initial position. Once the mouse moves away, I want the marquee to resume ...

Issues with div misalignment during jQuery animation

I have successfully created an animation where a child div inside a parent div moves up by -60px when the mouse enters the parent div, and returns to its original position when the mouse leaves. However, I am facing an issue where if the mouse moves direct ...

Issue with Material Design Lite input floating label not functioning properly post page navigation

I am currently developing a mobile hybrid application using Material Design Lite, but I have run into a small issue. When I add input field elements to my pages, the floating text and placeholder do not function properly. In my application, I am utilizing ...

What is the best way to extend the final column of a table across the entire width?

Here's the code I'm working with: .frm-find-people table td:nth-child(1) { padding: 5px 15px; width: 100px } .frm-find-people table td:nth-child(2) { border: 1px solid red; } <form class="frm-find-people"> <table> ...

Mastering the Art of Utilizing content_for and Rendering Partials in Rails 4

Recently, I discovered the power of utilizing content_for and found it to be incredibly useful. It may seem like I am making things more complicated than necessary, but my objective is: To create a custom header for the products#index page. As of now, I ...

What was the inspiration behind Spotify's section design?

Spotify has cleverly hidden the overflowing content without showing a scrollbar, allowing users to swipe through the list. How did they achieve this? I am currently using tailwindcss if that makes a difference. https://i.stack.imgur.com/z59yv.png ...

I am experiencing issues with the visibility of my background on certain mobile browsers

Apologies for repeating a similar question, but I've already tried the solutions mentioned in other posts. On my webpage, I have a table with a background image set using CSS. html { width:100% height: 100%; margin: 0px; padding: 0px; border: none; } ...

Please enter only numerical values using jQuery

Currently, I am facing a slight issue. My goal is to only run the code when the input characters are numbers. This is the snippet of code I have been working with: $(".jq-sales, .jq-variablecosts, .jq-fixedcosts, .jq-additional-sales, .jq-sales-units, .j ...

Sprockets could not locate the file for jquery.atwho

I have been attempting to integrate the jquery-atwho-rails into my application, a Rails gem designed for at.js. I have followed all the steps provided, executed bundle install, included the necessary code in both application.js and application.css, stopped ...

Ways to create intersecting borders at the corners of a division

Is there a technique to expand the borders of a div by 1 or 2 pixels in each direction so that they create a cross at each corner? https://i.stack.imgur.com/mUAxM.png ...

Guide on how to set the grid cell width to 0 for specific dimensions

What can be used in place of mdl-cell--0-col-phone to either disable an element or make its width zero? <div className="mdl-grid"> <div className="mdl-cell mdl-cell--2-col-phone mdl-cell--2-col-tablet mdl-cell--2-col-desktop"> <Left ...

How can you switch alignment from left to right when the current alignment settings are not functioning as expected in HTML?

I need the buttons +, count, and - to be right-aligned on my page. The numbers on the right are taking up the same amount of space, while the names on the left vary in length. I want the buttons to always remain in the same position, regardless of the name ...

Getting the location of a mouse click and adding tags (marks) on an image: a simple guide

Is there a way to incorporate images with tagged marks similar to Facebook's image tagging feature? How can I retrieve the X and Y coordinates of tags on the image itself (not the screen) and display them in a responsive manner? ...