简体   繁体   中英

How embedded image works in HTML?

I was reading a blog and I came across a simple snippet that rendered image without img tag or CSS. I would like to know how this works.

Snippet:

<span id="pie">🥧</span>

Copy and paste it in HTML file and the image gets rendered. How does this work? and what type of image can we embed in here?

The reason that you can do that is because the "image" that is used is actually an emoji. Emojis are considered to be characters, like letters in the alphabet, but it has colors. That's why it can be rendered without an <img> tag.

It's not an image, but an emoji inserted using the decimal (dec) or hexadecimal (hex) code (just like you render spaces using &nbsp; ). Check examples here

Here's another example snippet

<span style='font-size:100px;'>&#129312;</span>

and it renders : 🤠

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM