What <meta charset="utf-8"> does in HTML?

➊ What is it?

Let's break down.

✛ meta: It's a HTML tag that contains metadata about a web page.

✛ charset: An HTML attribute that defines the character encoding for your browser to use when displaying the website content.

✛ utf-8: It's a specific character encoding.
➋ Where should it be in HTML?

When we use this, it's recommended to place it inside "head" element near the top of the document which ensures to use the correct encoding.
➌ Why is character encoding important?

✧ Most websites these days has to display characters which are not traditional ASCII characters.

✧ When received such characters in HTML source, Browsers should be able to handle those to display properly.
➍ Various Character Encodings

HTML Standards has listed many encodings along with UTF-8 with reference to "Encoding Standards".

Some examples:

⮑ UTF-8
⮑ ISO-8859-2
⮑ windows-1251
⮑ windows-1252
⮑ GBK
⮑ UTF-16BE
⮑ x-user-defined

Find full list:
encoding.spec.whatwg.org/#names-and-lab…
➎ Why should we use UTF-8?

The HTML5 specification encourages web developers to use the UTF-8 character set, which covers almost all of the characters and symbols in the world.
➏ Alternatives

Are there any alternatives to <meta charset="utf-8">?

Well, yes. Let's explore those.
➏.➀ Content-Type

✧ Allow web server to include the Content-Type header in the response coming to browser.

Example:
Content-Type: text/html; charset=utf-8
➏.➁ http-equiv metadata

✧ Set content for <meta http-equiv="Content-Type" in HTML.

✧ When present, it must be inside head element near the top of the document.

Example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
➏.➂ BOM

✧ BOM (Byte-Order-Mark) is the usage of a special unicode character U+FEFF.

✧ It should be placed within the first 3 bytes of the document.
➏.➃ HTML Entities

✧ The fallback that HTML has to display properly all UTF-8 characters by using HTML entities.

Refer this cheat sheet for more idea:
➐ Final Words

❐ We have to use appropriate content type (charset encoding) to display all characters properly.

❑ As a fall back, use HTML entities where required. But, don't overuse those.
💭 Feedbacks

✧ Did you find this thread useful?
✧ After reading through entire thread, have you learnt something worth?
✧ What improvements will you suggest?

Hey 👋. I will be happy to hear from you. Your feedbacks would help me sharing better contents in future.
End of 🧵

Hey 👋 I am a Tech Educator from India 🇮🇳

I am sharing Tutorials, Tips, Techniques, Infographics, Cheat Sheets, Interview Questions and Roadmaps on Web Development, DSA and, Database.

Are you interested? I am sure, you are.

To never miss anything, Follow Me ✅

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Swapna Kumar Panda 

Swapna Kumar Panda  Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @swapnakpanda

Mar 25
Practice 50+ "Difference" Questions

❍ HTML
❍ CSS
❍ JavaScript

💭 Thoughts behind this Thread

✧ Comparison is one of the best technique to understand multiple concepts easily with less effort.

✧ Moreover, it also helps us understanding the use case for each.

Here, I have listed 50+ such questions from HTML, CSS & JavaScript.
➊ HTML

➀ "element" vs "tag"
➁ "head" vs "header"
➂ "link" vs "a"
➃ "div" vs "span"
➄ "ol" vs "ul" vs "dl"
➅ "th" vs "td"
➆ "radio" vs "checkbox"
➇ "q" vs "blockquote"
➈ "strong" vs "b"
➉ "em" vs "i"
➀➀ "strong" vs "em"
➀➁ "block" vs "inline"
Read 10 tweets
Mar 23
💎 60+ CSS Shorthand Properties : Cheat Sheet Here are 63 shorthand properties in CSS.  1 all 2 background
🌆 Direct Link for High Resolution Image

If you liked this one, give a ⭐️ to this GitHub repo to support my work.

✧ Direct Link:
github.com/swapnakpanda/I…
Do you want this entire list in text format?

Here are those.

➀ all
➁ background
➂ background-position
➃ font
➄ text-align
➅ text-decoration
➆ text-emphasis
➇ list-style
➈ offset
➉ overflow
Read 10 tweets
Mar 22
10 "important facts" about React Hooks

💭 Thoughts behind this Thread

⬖ Hooks are one of the most important features of React.

⬘ After the introduction of Hooks, the React development methodology has changed significantly.

⬗ Through this thread, I am attempting to make it easy to understand for you.


➹ It wasn't originally in React.js. It was introduced in React 16.8.
Read 14 tweets
Mar 21
15 Useful HTML Elements for Text Contents

📋 What shall we explore?

➊ abbr
➋ dfn
➌ em
➍ strong
➎ mark
➏ small
➐ q
➑ blockquote
➒ cite
➓ var
➊➊ code
➊➋ kbd
➊➌ samp
➊➍ data
➊➎ time
💭 Why is this Thread?

❑ In a typical web page, we render varieties of text contents. The context of few contents may vary from others.

❒ Sometimes we may have to highlight them semantically for SEO and Accessibility purposes.

❑ Let's explore 15 such HTML elements.
Read 21 tweets
Mar 20
How much JavaScript is good enough to start in React?

💭 Why is this Thread?

⬘ JavaScript and React both are popular and having a large share.

⬗ I have often seen people jumping straight to React without much knowledge in JavaScript.

⬙ Is this a good idea? If no, then how much JavaScript knowledge is enough to start React?
👩‍💻 Beginning Words

⬖ I suggest to start learning JavaScript first.

⬘ If you start with React, you would frequently travel between JavaScript and React making the learning progress slower.

⬗ Let's see how much JavaScript should be enough to start working in React.
Read 16 tweets
Mar 19
💜 JavaScript: Array's length vs String's length
-
Array's length property is mutable whereas String's length p
➊ Introduction

In JavaScript,

✧ Array is an Object whereas String is a primitive

✧ Despite String being a primitive, for easy operations it has a lot of methods and, properties

✧ String is considered as Array-Like

✧ Both Array and, String has a "length" property
➋ Array's length

✧ Unlike many other languages, JavaScript actually allows to modify an array's length manually.

✧ If we set a larger length, few blank spaces (holes) are added to the end.

✧ If we set a smaller length, elements are removed from the end.
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(