I'm making a webpage that's partly in Chinese. I use the UTF-8 encoding for all text. The page contains some parts that are in Chinese, mixed with western letters. The font I use for western text doesn't have Chinese characters in it, so I want the Chinese font available on the users computer to be used for rendering the Chinese characters (btw Chinese fonts are super big and not suitable for downloading on the fly).
Can I just put the Chinese characters in the middle of the other text, and expect the browser to find a Chinese font to render them in (if I don't care which font it's rendered in), or should I specify the Chinese font in some way?
How should I specify the font for the Chinese text to make sure the users browser displays 你好 and not □□?
On my browser (Firefox 56.0) the example below renders the Chinese text correct (of course given that there's a Chinese font installed on the computer) in both <span>
s. All Chinese text is rendered in the same font, so it looks like the browser in some way can find the font that has the glyphs that are being used in the text, even though I didn't specify the name of any font with Chinese glyphs ... Have no idea how that works :|
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<style>
span.serif {
font-family: "serif";
}
span.courier {
font-family: "courier";
}
</style>
</head>
<body>
<span class='serif'>123, wazzup? 一二三,你好嗎?</span><br />
<span class='courier'>123, wazzup? 一二三,你好嗎?</span>
</body>
</html>
The above is rendered like this on my computer: