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:

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

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:

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

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

Tips for seamlessly placing a div with a background image within a parent container, all while preventing any scrolling issues as the child div rotates

I created a simple demo featuring a square image with rounded corners to give it a circular appearance. The image rotates slowly, but as it moves diagonally, the horizontal width fluctuates, causing the parent container to resize. I want the parent contain ...

elevate the font size specifically for the descendants of a particular element

Currently, I am using rems to define the font sizes in my project. However, I have encountered a situation where I need to scale the font sizes at specific breakpoints without affecting the entire page, but just the text within a certain container. I under ...

What is the best way to align an image in the middle of an image slider within a Bootstrap

Struggling to align the image properly in a Bootstrap 5 image slider carousel: https://i.sstatic.net/upPza.png <div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel"> <div class=&qu ...

Problem with CSS animations in IE10

I've encountered a problem with a specific section of a website I created. This section functions perfectly on all browsers and older versions of Internet Explorer, but not on the latest versions. It seems that IE no longer supports [IF] statements in ...

Animating elements on a webpage can be achieved by using both

Is there a way to create an animation that moves objects based on button clicks? For example, when the "Monday" button is pressed, the object with the correct color will move down. If any other button like "Tuesday" is clicked, the previous object will mov ...

Ensuring consistent width for two divs using CSS

https://i.stack.imgur.com/3n8La.png I am currently working on creating a responsive CSS layout for two div elements. The first div will contain the summary, while the second div will hold the detailed description. My challenge is to make sure that the seco ...

Difficulty in accurately identifying the current page on the appbar

I'm attempting to make the active page in my navbar stand out by giving it a white background color and skyblue text. However, for some reason, I can't get the text color to display as skyblue in the appbar. You can see how it currently looks in ...

Is there a way to align the mat card title and subtitle on a single line?

My code is utilizing Angular material and here is the HTML snippet: <mat-card> <mat-card-header *ngFor="let club of result[0]"> <mat-card-title>{{club.clubName}}</mat-card-title> <mat-card-subtitle>Clu ...

PHP/CSS: Backgrounds for DIVs have been implemented, but they appear to be transparent

Update: Check out the link for some old photos here: I have a PHP file where I am creating divs with images as backgrounds using the code below (within a while-loop): echo ' <div class="pic" style="background:url('.$directory.'/'.$ ...

Adding a three-dimensional perspective to an HTML5 canvas without utilizing CSS3 or WebGL

Here is a canvas I am working with: http://jsbin.com/soserubafe Here is the JavaScript code associated with it: var canvas=document.getElementById("canvas"); var ctx=canvas.getContext("2d"); var w = canvas.width; var h = canvas.height; var cw=canvas. ...

What is the method used by Chrome dev tools to create CSS selectors?

When setting a new style rule for an element, Chrome generates a selector that includes the entire hierarchy of elements instead of just the class name. For instance: <body> <div class="container"> <span class="helper"> ...

What is the best way to incorporate an image zoom-in effect into a flexible-sized block?

Having a fluid grid with 3 blocks in one row, each set to width:33.3%. The images within these blocks are set to width: 100% and height: auto. I am looking to implement a zoom-in effect on hover for these images without changing the height of the blocks. I ...

Can someone point out the mistakes in my CSS Layout?

I've been struggling to make progress on this task over the past couple of days, encountering roadblocks with no clear solution in sight. The maze of nested divs I'm navigating through might be playing tricks on my mind, so having a fresh pair of ...

Different Line Thickness in Dropdown Menu

Is there a way to adjust line heights in CSS within a drop down menu? I have attempted to change the font sizes of each element, but the new font size does not seem to take effect once an option is selected. Any suggestions would be greatly appreciated! & ...

What is the solution for the error "At-rule or selector required" ?

Can someone help me with my CSS code issues? I'm having trouble on the first and last lines. Total newbie here :) Error Messages: at-rule or selector expected (ln 1, Col 1) at-rule or selector expected (ln 51, Col 1) &bso ...

Tips for connecting elements at the same index

.buttons, .weChangeColor { width: 50%; height: 100%; float: left; } .weChangeColor p { background: red; border: 1px solid; } .toggleColor { background: green; } <div class="buttons"> <p><a href="#">FirstLink</a></ ...

Error encountered while validating jQuery word cloud

Can anyone please assist me with validating a jQuery word cloud in HTML5? I'm encountering issues with all of the rel values showing this error message: "Bad value 1 for attribute rel on element a: Not an absolute IRI. The string 1 is not a registere ...

Having trouble displaying a gray background/overlay in a Twitter Bootstrap modal design

Library version: Jquery 1.11.0 Framework version: Bootstrap 3.1.1 CodePen link: https://codepen.io/amitshahc/pen/r6ueupfj/1/ HTML snippet: <!-- Modal --> <div class="modal fade" id="az-progress" tabindex="-1" role="dialog" aria-labelledby= ...

When you scroll a fixed element on the page, the block is truncated

I made a modification for adding cart items and included a script for managing my cart The cart is supposed to stick to the right edge and scroll up and down on the page Everything seems to work, but there's a slight issue when I click on Add 1 and ...

Can you explain the difference between serif and sans-serif fonts?

Can you explain the distinction between serif and sans-serif when it comes to the CSS font-family attribute? ...