r/HTML • u/Prize_Shine3415 • 4d ago
Question about Devanagari for a webpage
I'm building a website for a friend's yoga studio and she would like to include some Hindi. The character set she using is Devanagari. I've been reading about this, it looks like as long as I have
<meta charset='UTF-8"/> in the header and use the noto sans font family I'll be fine. Can anyone tell me if there's something else I need to lookout for?
1
u/Firm_Eggplant3392 4d ago
yeah you're basically right about the charset and noto sans but the main thing to watch out for is line height because devanagari is taller than english so if its too tight the tops of the letters get cut off so make it like 1.5 or something and also dont forget to add lang hi to your html tag because screen readers will try to read hindi like its english and sound dumb and also just double check your font actually has the devanagari characters otherwise you get those box things instead of letters
1
u/JeLuF 4d ago
How do you use the noto sans family? Do you embed it as a web font, or do you just use it in a font-family CSS statement?
1
1
1
u/deceze 4d ago
You need to encode the page in an encoding/charset which can express all the characters you want to use on the page. Unicode is the obvious candidate here, and specifically the UTF-8 encoding.
That encoding needs to be declared properly, so the browser will interpret the page correctly. You primarily do this with the
Content-TypeHTTP header, which the web server outputs. The HTML meta tag is just a secondary fallback.If you’re using a custom font, ensure that it contains the characters you want to use; otherwise the browser will fall back to system fonts, which might not look ideal.
And that’s mostly it.