Can we place `<img>` inside `<h1>` according to web standards?

Jitendra Vyas picture Jitendra Vyas · Oct 22, 2009 · Viewed 39.4k times · Source

Can we place <img> inside <h1> according to web standards? like this

<h1> Demo text <img src="anyimage.jpg"/> </h1>

Answer

Greg picture Greg · Oct 22, 2009

Yes, you can - the DTD says:

<!ELEMENT h1  %Inline;>
<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
<!ENTITY % special "%special.pre; | object | img ">

That basically means h1 can contain %Inline, which is made of various things, including img