How to put icon next to text?

Asked

Viewed 3,856 times

-1

Guys, I’m trying to put an image/icon on the side of a sentence, only the image goes up, it’s on top. How do I fix this?

Ex: (icon) Contact Us

  • 1

    Bruno puts the code he has already developed. To know how to ask questions on the site of a look https://answall.com/tour

  • the <img> tag is an inline tag, text too. If you do this: <p><img src="..." /> Hello</p> You have to stay on the side. I believe you are doing so: <img src="..."><p>Hello</p> This way you will fall, because <p> is a block tag.

2 answers

0

Just insert the image into the html inside the paragraph <p><img></p>, and adjust the image size:

img{
width:15px;
margin-right:5px;
}
<p><img src="https://image.flaticon.com/icons/svg/59/59965.svg"> Fale Conosco </p>

0

it is always good practice to use flexbox:

.mycontainer{
display: flex;
margin:5px;
}
<div class="mycontainer">

<span>
<img src="https://www.w3schools.com/html/pulpitrock.jpg" alt="">
</span>
<span>
lorem ipsum
</span>
</div>

Follow a link with great content on flexbox practice, helps a lot in day-to-day life: flexbox

Browser other questions tagged

You are not signed in. Login or sign up in order to post.