Try to use this:

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

instead of

href="../css/style.css

Here you are missing right apostrophe. Also check BalusC answer would solve your problem.

Note:

Also i recommend to you create resources folder on the same level as WEB-INF then in resources folder create css folder and then reference css file as:

WEB-INF
resources
  --css
    --styles.css
  --js
    --scripts.js 

and here how to connect css with page:

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

I'm using this approach is my web project and everything works correctly.

Answer from Simon Dorociak on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 72233888 › css-import-link-rel-stylesheet-href-style-style-css-doesnt-work
css import <link rel="stylesheet" href="style ...
you have to use: ../style/style.css as path. From your .ejs file you first have to go one folder below with ../. If this solves the issue then this soley is a typo caused issue and as such please remove the question voluntarily before more users try to answer instead of closing it. ... I don't see in your directory listing where your html files are. But if they're not in the directory above "style", then you'll want to change your link to:
Discussions

I can't link my CSS and I think I'm going insane
Do you normally save your ccs file as “styles” or “style”? More on reddit.com
🌐 r/css
17
8
May 25, 2019
CSS not working in stylesheet - Stack Overflow
I have a set of Styles that were first created inside the style attribute on a page. I want to move it from being on the page itself into a stylesheet. however, when I move it to a .css file, th... More on stackoverflow.com
🌐 stackoverflow.com
html - What is the reason for rel='stylesheet'? - Stack Overflow
I understand href='style.css' is telling the code to link to my 'style.css' page. But what is the reason for the second part? = rel='stylesheet'. Will this ever change? More on stackoverflow.com
🌐 stackoverflow.com
<link rel="stylesheet" type="text/css" href="../styles.css"> not working
Here's the Directory screenshot 1 Here's the Directory screenshot 2 I'm trying to build a Twitter clone as my first PHP project. But I'm facing this problem; the browser is not able to locate CSS f... More on stackoverflow.com
🌐 stackoverflow.com
February 25, 2018
🌐
Quora
quora.com › Why-is-my-CSS-not-linking-to-my-HTML-I-ve-put-link-rel-stylesheet-href-CSS-mystyle-CSS-but-it-still-will-not-work
Why is my CSS not linking to my HTML? I’ve put , but it still will not work. - Quora
Answer (1 of 2): Hi. I currently had the same issue. so I had a general folder X, where all my files are. Then I had a folder css and html for those file types respectively. Now the directories could be simplified as: desktop -> X -> css desktop -> X -> html Now if you want to acess a css file ...
🌐
Codecademy
codecademy.com › forum_questions › 553bcfc6d3292f7e1b000760
How do I actually link a CSS stylesheet to a HTML sheet? | Codecademy
if you have the css file in a subdirectoy (and the subdirectory is called styledirectory) the link becomes: <link rel="stylesheet" type="text/css" href="styledirectory/style.css" />
🌐
HTMLHelp
htmlhelp.com › reference › css › style-html.html
Linking Style Sheets to HTML
<LINK REL=StyleSheet HREF="basics.css" TITLE="Contemporary"> <LINK REL=StyleSheet HREF="tables.css" TITLE="Contemporary"> <LINK REL=StyleSheet HREF="forms.css" TITLE="Contemporary">
🌐
Codecademy
codecademy.com › forum_questions › 53e18ebe282ae3361f0015df
why is html link to css not working? | Codecademy
{ *<link type=”text.css” rel=”stylesheet” href=”journal.css”* /> } nothing happens even though the files are literally right next to each other. However, when I code this: { *<link type=”text.css” rel=”stylesheet” href=”../journal.css”* /> } it works.
Find elsewhere
🌐
sebhastian
sebhastian.com › css-not-linking-html
How to fix CSS not linking to your HTML document | sebhastian
September 11, 2017 - For example, suppose the name of your CSS file is my style.css, then here’s the correct name inside the href attribute: ... Because URL can’t contain spaces, it’s recommended that you replace all spaces in your CSS file with a hyphen - or an underscore _ so that my style.css becomes my-style.css or my_style.css. The <link> tag that you used in your HTML file must be a direct child of the <head> tag as shown below: <head> <link rel="stylesheet" href="style.css" /> </head> <body> <h1>Hello World</h1> </body>
🌐
Mimo
mimo.org › glossary › css › linking-a-style-sheet
Linking a style sheet in CSS: Learn to Connect CSS to HTML
Incorrect file path: If style.css is in a different folder, update the href value to match its location. Missing rel="stylesheet": If you forget this, the browser won’t treat it as a style sheet.
Top answer
1 of 9
24

This is just a shot in the dark as (at the time of this post) you haven't provided source code.

Make sure you're linking to your stylesheet using a link tag in the head of the HTML document.

If you had:

<style type="text/css">
/* <![CDATA[ */
#someid
{
  margin: 0;
  padding: 3px 12px;
}
/* ]]> */
</style>

You'll need to have

#someid
{
  margin: 0;
  padding: 3px 12px;
}

in your CSS file with:

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

to link to the stylesheet.

Some common newbie mistakes include:

  • <style type="text/css" src="path/to/style.css">: because it's a similar syntax to the <script> tag, which would make sense, but is invalid
  • <link rel="stylesheet" src="path/to/style.css">: but link elements use href not src
  • placing link elements within the body: although browsers will tend to manage link elements in the body, there are likely going to be some errors, and it's not a defined behavior
  • not specifying a doctype declaration: allows the browser to go into quirks mode, which is never a good idea.
2 of 9
4

You should make sure the stylesheet is properly imported. Sometimes the @import doesn't work well if not used accordingly, so always reference your stylesheet:

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

Always remember to close the <link> tag as it's a self-close tag. I think @zzzzBov forgot to mention that.

Finally, if that doesn't work, try to override some of the styles by physically writing (above the </head> section) something like:

<style type="text/css">
    body { background: blue; }
    * { color: red; }
</style>

and see if that gives you a blue background and red colored text. It should. After that, try to implement the referencing method and make sure you reference the stylesheet file to the right directory.

Good luck!

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › link
The External Resource Link element - HTML - MDN Web Docs
3 weeks ago - To include a stylesheet in a page, use the following syntax: ... You can also specify alternative style sheets. The user can choose which style sheet to use by choosing it from the View > Page Style menu. This provides a way for users to see multiple versions of a page. ... <link href="default.css" rel="stylesheet" title="Default Style" /> <link href="fancy.css" rel="alternate stylesheet" title="Fancy" /> <link href="basic.css" rel="alternate stylesheet" title="Basic" />
🌐
Sololearn
sololearn.com › en › Discuss › 2061733 › link-relstylesheet-typetextcss-hrefmystylecss-please-how-is-this-used
<link rel="stylesheet" type="text/css" href="mystyle.css"> please how is this used | Sololearn: Learn to code for FREE!
File.css. go to you html file and write the one you wrote above with the name as the href value and then run your html ... This code is for changing background. It has external css but it doesn't need link tag. As this code is in solo learn but out side of solo learn this css will not work if do not use link tag in your html ... Victor Aries This is used when you apply external CSS to your page. You create a new file with the extension ".css" and link it to your html part. The <link rel="stylesheet" from my understanding, I think means that you're making reference to a stylesheet page.
🌐
Imperial College London
ch.ic.ac.uk › local › it › css › style-html.html
Linking Style Sheets to HTML
<LINK REL=StyleSheet HREF="basics.css" TITLE="Contemporary"> <LINK REL=StyleSheet HREF="tables.css" TITLE="Contemporary"> <LINK REL=StyleSheet HREF="forms.css" TITLE="Contemporary">
🌐
GitHub
github.com › tailwindlabs › tailwindcss › discussions › 5660
How can not work with live-server? · tailwindlabs/tailwindcss · Discussion #5660 · GitHub
There was an error while loading. Please reload this page. ... What's in your public/styles.css file, can you see the Tailwind CSS classes in there? That file should be the generated CSS, not the @tailwind base/components/utilities directives (which go in src/styles.css)
Author   tailwindlabs
🌐
Stack Overflow
stackoverflow.com › questions › 48970569 › link-rel-stylesheet-type-text-css-href-styles-css-not-working
<link rel="stylesheet" type="text/css" href="../styles.css"> not working
February 25, 2018 - Glad it worked for you. Without seeing your project structure I can't tell you what was wrong with your document relative link. Probably just off by one level or something but that is the beauty of root relative; it makes it hard to encounter errors based on incorrect resource references.
🌐
Devpractical
devpractical.com › html-css-not-linking-properly
Why your html and css are not linking: how to link CSS to HTML properly · DevPractical
3 weeks ago - You can only use <style></style> HTML tags when you are writing your CSS in the head section of a HTML document itself not linking the CSS file. The correct HTML tag to link a CSS file to a HTML file is using the <link rel="stylesheet" href="main.css"/>. The "main.css" is the name of the CSS file.
🌐
W3Schools
w3schools.com › tags › tag_link.asp
HTML link tag
Link to an external style sheet: <head> <link rel="stylesheet" href="styles.css"> </head> Try it Yourself » · The <link> tag defines the relationship between the current document and an external resource. The <link> tag is most often used to link to external style sheets or to add a favicon to your website.
🌐
Stack Overflow
stackoverflow.com › questions › 44022824 › href-style-rel-what-is-the-right-order-when-linking-a-css-stylesheet-to-an-htm
href style rel - What is the right order when linking a CSS stylesheet to an HTML file - Stack Overflow
November 4, 2025 - "Is there something wrong if I will use for href , type and rel a different order?" — Do you have any reason to think that might be the case? Have you tested it? ... The attributes can be in any order. But, the best way to link CSS is before scripts that has to be included in page. Also the format for linking CSS should be as shown below: <link rel="stylesheet" type="text/css" href="mystyle.css">