How can I create an image displayed as a circle with border-radius:50%
, along with some text on the same line that has a set width and background color? I want to achieve this without hard coding values. What is the best approach to do this?
Check out the picturehttps://i.stack.imgur.com/EfA26.png
View the code in action on JSFiddle
<div class="header">
<img class="i" src="http://www.planwallpaper.com/static/images/colorful-triangles-background_yB0qTG6.jpg"/>
<p class="headingText">Hello</p>
</div>
.i {
width: 80px;
height: 80px;
border-radius: 50%;
}
.headingText {
color: white;
background: black;
display: inline-block;
width: 350px;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}