🌐
W3Schools
w3schools.com › css › css_howto.asp
How to add CSS
An external style sheet can be written in any text editor, and must be saved with a .css extension.
🌐
W3Schools
w3schools.com › html › html_css.asp
HTML Styles CSS
The CSS margin property defines a margin (space) outside the border. ... External style sheets can be referenced with a full URL or with a path relative to the current web page.
🌐
Code Institute
codeinstitute.net › blog › coding › external css
External CSS: What is it and When to Use - Code Institute Global
April 24, 2023 - It saves time because it is unnecessary to modify every CSS property on every website’s HTML page. Create an external CSS document with the help of an HTML text editor and implement CSS rules to begin linking style sheets to HTML files.
🌐
W3Schools
w3schools.com › css › css_external.asp
CSS External Stylesheet
CSS Templates CSS Examples CSS ... CSS Browser Support ... With an external style sheet, you can change the look of an entire website by changing just one file!...
🌐
Quackit
quackit.com › css › external_style_sheets.cfm
External Style Sheets
You then link to the external style sheet from all your HTML pages. This means you only need to set the styles for each element once. If you want to update the style of your website, you only need to do it in one place. Type CSS code into a plain text file, and save with a .css extension (for example, styles.css).
🌐
Reddit
reddit.com › r/learnprogramming › adding external css file to html doc
r/learnprogramming on Reddit: Adding external css file to html doc
June 1, 2022 -

I feel stupid and like I have taking 3 steps back in my learning. I am trying to figure out the 3 different implementations of css. Doing External now. Just trying this super simple code, the colors did not show up in the browser like they did on w3schools.

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

</body>

</html>

Is it because I don't have a css file on my computer? Do I need to download one? Copy and paste from somewhere? I don't get it. I prefer building with the css and html on the same document because I haven't learned how to do anything else yet. I have been able to follow tutorials fine but for some reason, now it's not clicking.

🌐
GeeksforGeeks
geeksforgeeks.org › css › how-to-link-external-css-to-html
How to Link External CSS to HTML? - GeeksforGeeks
The <link> element should have ... link an external CSS file to an HTML document, you need to use the <link> element within the <head> section of your HTML file....
Published   October 8, 2024
🌐
Hostinger
hostinger.com › home › tutorials › types of css: inline, external and internal definitions and differences explained
Types of CSS: Inline, Internal and External CSS Explained
April 23, 2025 - Adding the code to the HTML document can increase the page’s size and loading time. With external CSS, you’ll link your web pages to an external .css file, which can be created by any text editor in your device (e.g., Notepad++).
🌐
Javatpoint
javatpoint.com › external-css
External CSS - javatpoint
CSS External with examples on inline, file, selector, background, border, display, float, font, margin, opacity, overflow, padding, position, text-align.
Find elsewhere
🌐
Team Treehouse
teamtreehouse.com › community › external-style-sheet
External Style Sheet (Example) | Treehouse Community
May 19, 2014 - Well for this exercise I created a "css" folder and I put the HTML index document within it along with the style sheet.
🌐
W3Schools
w3schools.com › css › tryit.asp
External CSS
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Styling_basics › Getting_started
Getting started with CSS - Learn web development | MDN
If you are working through this ... You should however still read through the section to be aware of the content. An external stylesheet contains CSS in a separate file with a .css extension....
🌐
SheCodes
shecodes.io › athena › 42986-how-to-use-external-css-when-coding-html
[HTML] - How to use external CSS when coding HTML - | SheCodes
Learn how to link an external CSS stylesheet to your HTML document to style your website and improve its design and functionality.
Top answer
1 of 2
5

There are a few parts to this:

  1. Firstly, create an external style sheet ('style.css' - or whatever)
  2. You must reference this .css file in the head of your HTML document
  3. You must accurately reference / move all inline styles to the external .css file


Firstly, create an external style sheet ('style.css' - or whatever)

You can do this by creating a new Notepad solution & hit 'Save As'. Ensure you save it with the extension '.css'. If you're unsure how to do this, refer here: Save As Other File Type Notepad


You must reference this .css file in the head of your HTML document

This can be done like so:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="style.css">
</head>
<body>
</body>
</html>

Refer here for more information: Reference External Style Sheet.

Please note, if the 'style.css' file is not in the same folder as your .html file & is instead in a folder called 'Folder', you will need to reference it like this instead:

<link rel="stylesheet" href="/Folder/style.css">


You must accurately reference / move all inline styles to the external .css file

You can add identifiers to your tags, i.e. you can add an 'id' or a 'class' attribute to any tag, these will help reference your item in css.

You can add an id to a tag like so: <label id="lblMyLabel">Example Text</label>
You can add a class to a tag like so: <label class="lblMyLabel">Example Text</label>

You can reference an id in css like so: #lblMyLabel { font-weight:bold; }
You can reference a class in css like so: .lblMyLabel { font-weight:bold; }

For more examples how to reference an ID see here: CSS ID Selectors
For more examples how to reference a class see here: CSS Class Selectors

This article gives a good overview of the conversion as well: How To Add CSS


Here are examples of before & after the conversion for your reference:


BEFORE

<label style="color:green; font-weight:bold;">I am your heading</label>

AFTER

#lblHeading {
      font-weight:bold;
      color:green;
    }
<label id="lblHeading">I am your heading</label>



BEFORE

<label style="color:green; font-weight:bold;">I am your heading</label>

AFTER

.lblHeading {
          font-weight:bold;
          color:green;
        }
<label class="lblHeading">I am your heading</label>



BEFORE

 <div style="padding-top:10px; background-color:green;">
      <div style="padding-top:2px; background-color:red;">
          <label style="font-weight:bold;">Example</label>
          <img src="" style="height:10px;"/>
      </div>
    </div>

AFTER

.outerDiv {
  padding-top:10px;
  background-color:green;
}

.outerDiv .innerDiv {
  padding-top:2px;
  background-color:red;
}

.outerDiv .innerDiv #lblMyLabel {
 font-weight:bold;
}

.outerDiv .innerDiv #imgMyImage {
 height:10px;
}
 <div class="outerDiv">
      <div class="innerDiv">
          <label id="lblMyLabel">Example</label>
          <img id="imgMyImage" src=""/>
      </div>
    </div>

If you have any questions or want to supply some of your code, I'm happy to help show you a few conversions!

2 of 2
2

Use <link rel="stylesheet" href="styles.css"> in HTML file I put a link for tutorial to learn how to use css, I hope it will help your study https://www.w3schools.com/html/html_css.asp

  <!DOCTYPE html>
  <html>
    <head>
      // Link to your external css
      <link rel="stylesheet" href="styles.css">
    </head>

    <body>
      <h1>This is a heading</h1>
      <p>This is a paragraph.</p>
    </body>
  </html>
🌐
HubSpot
blog.hubspot.com › home › website › how to add css to html: understanding inline, internal & external css
How to Add CSS to HTML: Understanding Inline, Internal & External CSS
March 13, 2023 - Internal CSS is written inside a <style> element, which goes inside the <head> of the HTML document. External CSS is written in a separate file called an external stylesheet, and linked to the HTML document with a <link> tag.
🌐
CodeSignal
codesignal.com › learn › courses › building-a-static-todo-list-with-html-css › lessons › linking-external-css-to-html
Linking External CSS to HTML
External CSS is simply a separate file, containing only CSS rules with a .css extension. You can link this to your HTML file, allowing you to apply the same styles across multiple web pages. Think about different methods of CSS as different approaches to book cover design.
🌐
Study.com
study.com › courses › computer science courses › introduction to html & css
External Style Sheets in CSS: Definition & Examples - Lesson | Study.com
September 22, 2020 - External style sheets are separate files with a .css extension that are referenced in the main HTML document.
🌐
Quora
quora.com › How-do-you-create-an-external-style-sheet-in-HTML-and-CSS
How to create an external style sheet in HTML and CSS - Quora
Answer (1 of 3): 1. Create the CSS File * Create a new file with the [code ].css[/code] extension (e.g., [code ]style.css[/code]). * Write your CSS rules within this file. Example [code ]style.css[/code]: body { background-color: lightblue; font-family: sans-serif; } h1 { color: navy; t...
🌐
Simplilearn
simplilearn.com › home › resources › software development › how to link external css in html
How To Link External CSS in HTML | Simplilearn
December 2, 2025 - External CSS (file) is a form of CSS which is used to add styling to multiple HTML pages at a time. It helps to design the layout of many HTML web pages simultaneously. Read more!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States