CSS Fonts
font-family property controls which font appears on your page. You can use system fonts or load custom fonts from Google Fonts — for free.
Right now our Netflix page uses whatever default font the browser picks. That's fine, but it doesn't look like Netflix. Let's fix that.
font-family
The font-family property tells the browser which font to use for the text on your page. Here's the basic syntax:
body {
font-family: Arial;
}
That one line changes the font for everything on the page. But what happens if the user's computer doesn't have Arial installed?
Fallback Fonts
You can give the browser a list of backup fonts to try. This is called a font stack. The browser reads the list left to right and uses the first one it finds.
body {
font-family: "Bebas Neue", Arial, sans-serif;
}
Here the browser tries Bebas Neue first. If it's not available, it tries Arial. If that's not available either, it falls back to any sans-serif font the system has.
Always end your font stack with a generic family — serif, sans-serif, or monospace. This guarantees something readable always shows up.
Google Fonts
Most custom fonts aren't installed on people's computers by default. Google Fonts lets you load any font for free over the internet.
Here's how to add the Bebas Neue font — it gives your heading a bold, cinematic look, similar to what Netflix uses.
Step 1 — add this <link> tag inside the <head> of your HTML, before your stylesheet:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
Step 2 — use it in your CSS:
h1 {
font-family: "Bebas Neue", Arial, sans-serif;
}
body {
font-family: "Roboto", Arial, sans-serif;
}
We're using two fonts here on purpose. Bebas Neue is bold and condensed — great for the big Netflix headline. Roboto is clean and readable — perfect for body text and paragraphs.
Click Try It Yourself to see the font change. Notice how "Netflix" instantly looks more dramatic with Bebas Neue.
Netflix
Unlimited movies, TV shows, and more
Starts at USD 2.99. Cancel anytime.
body { background-color: rgba(0, 0, 0, 0.8); background-image: url('https://assets.nflxext.com/ffe/siteui/vlv3/9ba9f0e2-b246-47f4-bd1f-3e84c23a5db8/web/NP-en-20251020-TRIFECTA-perspective_774f89dc-b75d-4cfc-b1fe-52086741fae3_large.jpg'); background-blend-mode: multiply; background-size: cover; margin: 0; padding: 40px; font-family: "Roboto", Arial, sans-serif; color: white; } h1 { font-family: "Bebas Neue", Arial, sans-serif; color: #e50914; } h2 { font-family: "Roboto", Arial, sans-serif; font-weight: 700; } p { font-family: "Roboto", Arial, sans-serif; }font-family for Different Elements
You don't have to use the same font for everything. A common pattern is to use a display font (like Bebas Neue) for headings only and a clean readable font for everything else:
/* Headings get the bold cinematic font */
h1, h2 {
font-family: "Bebas Neue", Arial, sans-serif;
}
/* Body text stays clean and easy to read */
body {
font-family: "Roboto", Arial, sans-serif;
}
Put quotation marks around font names that have spaces in them — like "Bebas Neue" or "Times New Roman". Single-word fonts like Arial don't need quotes.
Have anything to say about this lesson?
Your feedback helps improve these tutorials. If something was confusing or missing, let us know.