Skip to content Skip to sidebar Skip to footer

Why Is My External Css Not Working?

I am trying to link an external stylesheet to all my pages but it is not rendering. It works only on my homepage but not on other pages. I am using the exact same link on all pages

Solution 1:

Try it like this:

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

inside your subfolder pages.


Solution 2:

In one of the comments you say "My style sheet is in the main folder along with homepage. Subfolders have files of each pages.".

So assuming the site's folder structure is like

|- home.html
|- stylesheet.css
|- folder1
|------page1.html
|- folder2
|------page2.html

The link in home.html should be

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

and the links in page1.html and page2.html should be

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

This just means "the CSS file is one folder above the curent one".


Solution 3:

place css file inside a folder name it CSS and place your css file inside it

And try this method

<head> 

        <title> Website name </title>

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

    </head>

If you still have problem then check your file name and extension are same in both files


Solution 4:

Kindly check your root folder may be

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

Post a Comment for "Why Is My External Css Not Working?"