Home > Blockchain >  Having issue with alignment of multiple circular item in a row
Having issue with alignment of multiple circular item in a row

Time:01-05

I have created a circular shape where I show some percentages. I want to put multiple items in a row.

I tried with div and making display flex and nothing is working properly. Here is a what I tried so far:

 .meal-circular-progress{
  position: relative;
  height: 100px;
  width: 100px;
  border-radius: 50%;
  background: conic-gradient(#7d2ae8 0deg, #ededed 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin:auto;
 //transition: background 2s;
 //transition-timing-function: ease; 
 //border: 1px solid red;
}
.meal-circular-progress::before{
  content: "";
  position: absolute;
  height: 80px;
  width: 80px;
  border-radius: 50%;
  background-color: #fff;
//border: 1px solid red;
}



.progress-value{
   position: relative;
   font-size: 40px;
   font-weight: 600;
   color: #7d2ae8;
}
<div >
      <div  ng-style="c.circular">
        <span >10%</span>
      </div>
      <div  ng-style="c.circular">
        <span >10%</span>
      </div>
      <div  ng-style="c.circular">
        <span >10%</span>
      </div>
</div>

CodePudding user response:

You need to make your parent element flexbox. In this case your parent element is center.

Make that element flexbox and use the align-items property to do so:

  .center {
      display: flex;
      align-items: center;
      justify-content: center;
  }

 .meal-circular-progress {
      position: relative;
      height: 100px;
      width: 100px;
      border-radius: 50%;
      background: conic-gradient(#7d2ae8 0deg, #ededed 0deg);
      display: flex;
      align-items: center;
      justify-content: center;
      margin: auto;
  }

 .meal-circular-progress::before {
      content: "";
      position: absolute;
      height: 80px;
      width: 80px;
      border-radius: 50%;
      background-color: #fff;
  }

  .progress-value {
       position: relative;
       font-size: 40px;
       font-weight: 600;
       color: #7d2ae8;
   }
<div >
      <div  ng-style="c.circular">
        <span >5%</span>
      </div>
      <div  ng-style="c.circular">
        <span >10%</span>
      </div>
      <div  ng-style="c.circular">
        <span >20%</span>
      </div>
</div>

CodePudding user response:

Flex the container

https://codepen.io/mplungjan/pen/xxJEPwx

#container {
  display: flex;
  flex-direction: row;
  min-width: max-content;
  max-width: max-content; /* optional */
  border: 1px solid black;
}
  • Related