IMB
IMB

Reputation: 15889

Align an image inside paragraph in HTML5

I used to just align="left" an img inside p tags before but align is not supported anymore in HTML5.

What's the recommended way of doing the code below in HTML5?

<p>
  <img src="https://placehold.it/50x50" align="left">
  some long text
</p>

Upvotes: 0

Views: 276

Answers (1)

Itay Gal
Itay Gal

Reputation: 10834

You can use

p img{
  float: left;
}

This rule will apply on all images under <p>

p img{
  float: left;
}
 <p>
        <img src="https://fakeimg.pl/30x30/?text=A"/>
        some long text
    </p>

Upvotes: 1

Related Questions