Interview Question

What is the purpose of charset in meta tags?

`<meta charset="utf-8">` declares that the document uses UTF-8.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

The charset declaration tells the browser which character encoding the HTML document uses. • For HTML documents, authors should use UTF-8. • Place `<meta charset="utf-8">` early in the `<head>`. • A correct encoding prevents text from being decoded as the wrong characters.

💡 Simple Example

<head><meta charset="utf-8"><title>UTF-8 page</title></head>

⚡ Quick Revision

`<meta charset="utf-8">` declares that the document uses UTF-8.