1

I'm new to coding and have only learned how to use HTML and CSS. If I use notepad++ how do I make an external stylesheet?

4
  • Are you attempting to use the CSS file to change the Notepad++ editor or to change a website you are implementing? Commented Jan 9, 2021 at 2:11
  • i think im trying to change a website and not notepad++ itself. this is the first time i have written a code from scratch on my own.im trying to change things like font and color. Commented Jan 9, 2021 at 2:19
  • Does this answer your question? Adding external CSS in an HTML file Commented Jan 9, 2021 at 2:32
  • Open the developer tools of your browser (CTRL+K or CTRL+I) and navigate to Network and ensure that the HTTP response code is 200 for the style sheet you include via the link element. If it isn't working you'll be able to boost your debugging skills by learning how to combine Apache access logs (and eventually MariaDB general query logs) with a log viewer. I highly recommend Hoo WinTail with highlight filters that allow to launch an external program (e.g. sounder.exe) that can alert you that your error matched and you know when to look at your logs: very powerful. Good luck! Commented Jan 9, 2021 at 3:18

1 Answer 1

4

You can add CSS styles to an HTML document by using the <link> element. It's documentation is here.

Here is a simple example that assumes both files are in the same directory:

styles.css

.my-class {
  background-color: red;
}

index.html

<!doctype html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="./styles.css">
    </head>
    <body>
        <p class="my-class">The background of this paragraph will be red.</p>
    </body>
</html>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.