If you wrote some CSS and nothing on your page changed, How to link CSS to HTML comes down to one line in the right place, pointing at the right file. This guide walks through that line, the two other ways to add CSS, the path mistakes that break the connection, and a quick way to prove it is working. It follows MDN Web Docs, the web reference maintained by Mozilla, checked December 2, 2026.
VetBoss is not affiliated with, endorsed by or sponsored by Mozilla or MDN Web Docs.
The short answer
Put a link element inside the head of your HTML file, with rel set to stylesheet and href set to the path of your CSS file. MDN's starter guide uses exactly this line:
<link rel="stylesheet" href="styles.css" />
MDN explains that this element tells the browser "that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute." (MDN: Getting started with CSS)
Step by step
1. Make the files. Create index.html and, in the same folder, a file named styles.css. MDN's guide does the same: create the CSS file "in the same folder as your HTML document and save it as styles.css".
2. Add the link inside the head. A stripped-down page looks like this (a real page would also set its language and character encoding):
<!doctype html>
<html>
<head>
<title>My page</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Hello</h1>
</body>
</html>
3. Add a rule you can see. MDN suggests a test like this in styles.css:
h1 {
color: red;
}
4. Save both files and reload the page. If the heading turns red, the link works. If not, jump to the troubleshooting list below.
What the link element actually is
MDN's reference page says the link element "specifies relationships between the current document and an external resource." It adds that the element "is most commonly used to link to stylesheets" but is also used for things like site icons. (MDN: link element)
That is why the rel attribute matters. On the same page, MDN notes "The rel stands for" relationship. If rel is missing or misspelled, the browser does not know the file is a stylesheet.
The three ways to add CSS
MDN names three methods you will come across: external stylesheets, internal stylesheets and inline styles.
External stylesheet (the one above). MDN says "An external stylesheet contains CSS in a separate file with a .css extension." It calls this "the most common and useful method of bringing CSS to a document." The advantage: "You can link a single CSS file to multiple web pages, styling all of them with the same CSS stylesheet."
Internal stylesheet. CSS goes inside a style element in the head. MDN's reference says the style element "contains style information for a document, or part of a document." This is handy for a single test page, but the styles live in just that one file. (MDN: style element)
Inline styles. CSS goes in a style attribute on one element. MDN is blunt about the downside: "inline CSS also mixes (CSS) presentational code with HTML and content, making everything more difficult to read and understand."
For anyone building real pages: start with an external stylesheet and keep it that way unless you have a specific reason not to.
Planning your next career step? Check your eligibility.
Why your CSS is not loading: a troubleshooting list
When the heading stays black, check these in order. Most problems are one of the first three.
- The path is wrong. The href is relative to the HTML file. If your CSS lives in a folder named css, the href needs to be
css/styles.css. If the HTML file sits inside a folder and the CSS is one level up, use../styles.css. - The file name does not match. styles.css and style.css are different files. On many web servers, capital letters matter too, so Styles.css will not match styles.css.
- The link is outside the head, or misspelled. Check that rel is spelled correctly, that the value is stylesheet with no typo, and that the closing angle bracket is there.
- The file was saved somewhere else. Some editors save to a default folder. Confirm the CSS file sits where you think it does.
- The browser is showing an old copy. Do a hard refresh, or open the page in a private window.
- Another rule is winning. If one rule works and another does not, a more specific selector or a later rule may be overriding it.
Check it with the browser's developer tools
Right-click the page and choose Inspect. In the Network panel, reload the page and look for your CSS file. A missing file usually shows up as an error, which tells you the path is the problem. In the Elements panel, click your heading and look at the Styles pane to see which rules apply and which are crossed out.
Getting comfortable with these tools early turns guesswork into a quick check.
Linking more than one stylesheet
You can add several link elements in the head, one per file. A common setup is a base file for fonts and colors, then a file for one section of the site. Keep the order in mind: when two rules carry the same weight, the one that loads later wins.
Where this fits in a developer's path
Linking CSS is one of the first real connections between two languages you will make, and it shows how a web page is assembled from separate pieces. If you are still sorting out the two languages, see the posts on HTML vs CSS and whether HTML is a programming language. For the bigger picture, read how to become a web developer, and the HTML certification post covers what is out there.
Where VetBoss fits
Step Into Tech is VetBoss's AI Engineer path, in two stages. Stage 1, Full Stack Developer, covers HTML and CSS, JavaScript, Python, React JS, Certified GPT and MySQL, in live instructor-led classes with hands-on projects. Stage 2 is the apprenticeship part of the path and is not open yet: Join waiting list. See Step Into Tech.
Your next step
Thank you for reading, and thank you for your service. VetBoss serves veterans, and the team is glad to hear from you.
You came here to learn how to link CSS to HTML. If you have served and are starting to think about what comes after service, let's map out what comes next. Our military skills translator is a place to start.
Book an eligibility call, or call 855-VET-BOSS (855-838-2677).