The progress bar is currently aligned vertically. How can I align them horizontally and in the center?
To achieve this, simply update your wrapper
rule to:
.wrapper {
display: flex;
justify-content: center;
}
I recommend making some CSS changes (refer to notes). Additionally, there is no need to use the child selector >
combined with an id selector #
, like .wrapper > #bar
, as there is only one element with that id
View updated fiddle with suggested changes
Stack snippet
var circle = new ProgressBar.Circle('#bar', {
strokeWidth: 4,
color: '#000'
});
circle.animate(1);
var circle = new ProgressBar.Circle('#bar2', {
strokeWidth: 4,
color: '#000'
});
circle.animate(1);
var circle = new ProgressBar.Circle('#bar3', {
strokeWidth: 4,
color: '#000'
});
circle.animate(1);
.wrapper {
display: flex;
justify-content: center;
}
#bar, /* Changed ".wrapper > #bar" to "#bar" */
#bar2,
#bar3 {
position: relative;
margin: 0 5px; /* Added a gap between the circles */
}
.wrapper img {
box-sizing: border-box;
padding: 4%;
border-radius: 50%;
width: 100%; /* Added for scaling on smaller screens */
}
.wrapper svg {
position: absolute;
top: 0;
left: 0;
}
<script src="https://rawgit.com/kimmobrunfeldt/progressbar.js/master/dist/progressbar.js"></script>
<div class="wrapper">
<div id="bar"><img src="http://i.imgur.com/391FcV0.png" /></div>
<div id="bar2"><img src="http://i.imgur.com/NtqQEKF.png" /></div>
<div id="bar3"><img src="http://i.imgur.com/NGROIlB.png" /></div>
</div>