Reputation: 2520
I have circles lined up using flexbox and they look decent on small screen width:
but as soon as I widen the width of my screen, they look really stretched. But I need them to be round from every prospect.
I'm not sure maybe there is a way that fixes their displaying on different screen sizes. Maybe I could have used some media queries. How to handle this?
HTML
<div class="dashboard-grey-menu">
<div class="flex row no-padding">
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
</div>
</div>
CSS
.dashboard-grey-menu {
height: 30vh;
background-color: #959595;
}
.circle {
border-radius: 50%;
width: 15vw;
height: 25vh;
background-color: #B7B7B7;
margin: auto;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
height: 30vh;
width: 100%;
}
Upvotes: 2
Views: 1316
Reputation: 43594
You have to set the width
and height
of your circle to the same value:
.dashboard-grey-menu {
height: 30vh;
background-color: #959595;
}
.circle {
border-radius: 50%;
width: 10vw;
height: 10vw;
background-color: #B7B7B7;
margin: 20px;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
height: 30vh;
width: 100%;
}
<ion-content has-header="false">
<div class="dashboard-grey-menu">
<div class="flex row no-padding">
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
<div class="col"><div class="circle"></div></div>
</div>
</div>
</ion-content>
Upvotes: 7