How do I connect my html and css codes so they can be read by web browser?

How do I connect my html and css codes so they can be read by web browser?
0

#1

Hi there,

I am a real beginner. Just started learning html and css. Here is my very first question on this forum. Hope you can help!

I am writing my html codes in Notepad and then save them as .html document. Can I write my css codes as well in Notepad and save them as .css document??? And how do I connect those two documents? I tried smtng like this:

<link type="text/css" rel="stylesheet" href="stylesheet.css"/>

but it didn’t work? Why? I made a simple css code just to change my background color in grey, but nothing happened :frowning:

I have windows 7 btw, if that’s important for you to answer my question.

What software/programs/text editors do you use in your web design process?

Thanks in advance for your help!


#2

How is your css file called?


#3

I warmly suggest you to use vscode as your text editor. It’s free to download and it’s awesome. Now about your question. You can use Notepad to write your html and css and any other file type, but when including your css, be sure that you provide the right path to it. For example if href="stylesheet.css", then it means that those 2 files(html file and css file) are in the same folder. Usually you put your <link> tags inside html <head> tag.


#4
  1. Drop Notepad asap. Use VSCode or Brackets, both are free.
  2. I assume you already understand that the href="stylesheet.css" points to the stylesheet with that exact name and in the exact same folder as your html file. Have you wrapped this line around the head tag?

Like this:

<head>
  <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
</head>

Other things, like document title (it displays at the top of the browser) also go in there. Remember that you only need one head tag to store all head-related information.