Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

question regarding img tag in html

Tags:

html

css

image

Should the <img> tag be wrapped in a <p> tag or can it be just used without a <p> tag?

like image 226
kjkjl Avatar asked Dec 07 '22 04:12

kjkjl


1 Answers

<img> is an inline element and as such needs to be placed inside a block level element to validate.

Something like a <p>, <div>, <h1>, or a <li> would suffice.

Inline elements cannot be placed directly inside the body element; they must be wholly nested within block-level elements.

like image 144
Jonny Haynes Avatar answered Dec 27 '22 07:12

Jonny Haynes