It's hard to ask this question without a visual reference, so I included a picture below (as well as a code snippet). I'm trying to achieve two things:
- right-align the blue
<span>
circle inside the yellow<p>
box - keep the text centered in the
<p>
box, independent of the blue circle
This is my code:
.circle {
height: 20px;
width: 20px;
background-color: blue;
border-radius: 50%;
display: inline-block
}
.box {
background-color: yellow;
height: 30px;
width: 500px;
text-align: center;
margin: 10px
}
<p class='box'>This is centered</p>
<p class='box'>This is not<span class='circle'></span></p>
I'm not super familiar with HTML, but I tried doing align-self: right
for the circle, but nothing happened. Not sure what to do.
Here is a picture of what I'm trying to achieve: