Reputation: 343
I would like to align the text under the circle, perfectly on the middle.
Here a snippet (I simplified everything because circle and text are handled by angular so they are some difference between my screenshot and the snippet)
.circle2 {
border-radius: 50%;
width: 18px;
height: 18px;
background: RoyalBlue;
display: inline-block;
z-index: 2;
}
.wrapper2 {
display:flex;
width:100%;
justify-content: space-around;
position:relative;
}
.wrapper2:after {
position:absolute;
content:'';
display:block;
width: 100%;
top:7px;
height: 3px;
background: RoyalBlue;
}
.advanced2 {
width: 18px;
height: 18px;
}
.circleActive2 {
border-radius: 50%;
width: 25px;
height: 25px;
background: RoyalBlue;
display: inline-block;
}
<div class="w3-container">
<div class="wrapper2">
<span>
<span><div class="circle2 advanced2" ></div>test</span>
<span><div class="circle2 advanced2 circleActive2" ></div>test2</span>
<span><div class="circle2 advanced2" ></div>test3</span>
<span><div class="circle2 advanced2" ></div>test4</span>
<span><div class="circle2 advanced2" ></div>test5</span>
</span>
</div>
</div>
Upvotes: 0
Views: 42
Reputation: 51
I guess it should work like the following: You can change the max-width and the margin of the ".wrapper2" to without a problem.
.wrapper2 {
width:100%;
position:relative;
text-align:center;
max-width:600px;
margin:50px auto;
}
.wrapper2 > span {
position:relative;
width:100%;
-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-justify-content: space-around;
-moz-justify-content: space-around;
justify-content: space-around;
display: -webkit-flex;
display: -moz-flex;
display: flex;
}
.wrapper2:after {
content:"";
position:absolute;
display:block;
width: 100%;
top:7px;
left:0;
height: 4px;
background: RoyalBlue;
}
.advanced2 {
width: 18px;
height: 18px;
display:block;
position:relative;
margin: 0 auto 5px;
border-radius: 50%;
width: 18px;
height: 18px;
background: RoyalBlue;
z-index: 2;
}
.circleActive2 {
margin: -4px auto 1px;
width: 26px;
height: 26px;
}
.advanced2 + i {
font-style:normal;
display:block;
}
<div class="wrapper2">
<span>
<span><div class="advanced2"></div><i>test</i></span>
<span><div class="advanced2 circleActive2"></div><i>test2</i></span>
<span><div class="advanced2"></div><i>test3</i></span>
<span><div class="advanced2"></div><i>test4</i></span>
<span><div class="advanced2"></div><i>test5</i></span>
</span>
</div>
Hope I could help!
Upvotes: 1
Reputation: 887
.circles {
display: flex;
width: 100%;
justify-content: space-around;
position: relative;
}
.circles:after {
position: absolute;
content: '';
display: block;
width: 100%;
top: 7px;
height: 3px;
background: RoyalBlue;
}
.circles > div {
display: flex;
flex-direction: column;
align-items: center;
}
.circle {
border-radius: 50%;
width: 17px;
height: 17px;
background: RoyalBlue;
}
.circle.active {
width: 25px;
height: 25px;
margin-top: -4px;
}
<div class="circles">
<div><span class="circle"></span>test</div>
<div><span class="circle active"></span>test2</div>
<div><span class="circle"></span>test3</div>
<div><span class="circle"></span>test4</div>
<div><span class="circle"></span>test5</div>
</div>
Upvotes: 1