The name of the CSS file, if they’re in the same directory.
Its for when you host your style sheet somewhere else.
For example you host it on a different site, the href will be the URL link to were the style sheet is.
<link rel="stylesheet" href="https://www.myhost.co.uk/style.css">
if it’s a local css file you can also do…
<link rel="stylesheet" href="styles.css">
If your styles and html are in the same directory…
the href should be where the css file is. Example: if you have a folder to your css, the href should be href=“myCss/style.css” where “myCss” is the name of the folder
Just an added note as I’ve seen this mistake happen commonly, if you are not using the full url in href put
style.css and not
/style.css or it will attempt to load style.css from the root of the directory and this has problems if you are loading the file from a subfolder. None of the examples above have this issue but just adding here just in case that type of issue occurs
Href must be a name of an CSS file , example :
+NOTE: that CSS stylesheet MUST be in same FOLDER like your html file!.
@harsh124 I usually put my CSS files in this folder under my project folder:
Then, I link to it in my
index.html file (located in
/home/user/project_folder/) like this:
<link rel="stylesheet" type="text/css" href="./resources/css/style.css">