I'm having trouble creating a header bar on my HTML page with a h1 and h2 element, along with an image positioned to the right of both. No matter what I try, the image keeps appearing below the other elements. I attempted using display:inline-block; but that didn't solve the issue.
Any suggestions on how I can achieve this?
.headerBar {}
.headerBar h1 {
float: left;
width: 400px;
line-height: 0;
}
.headerBar h2 {
width: 400px;
line-height: 1;
}
.headerBar img {
width: 40px;
border-radius: 50px;
}
<div class="headerBar">
<h1>My Name</h1>
<h2>Welcome</h2>
<img src="https://dummyimage.com/300x200/000000/fff" alt="Photo" />
<br>
</div>