How do I insert CSS into HTML from an external file?

+2 votes
I've added the tag in the HTML file, and the CSS file exists, but it has no effect on the style
asked Jul 8 by BusyB (100 points)
retagged Jul 9 by BusyB

2 Answers

+3 votes

I'm guessing this is the tag you used in the HTML file to add it:

<link rel="stylesheet" href="styles.css">

In case your web project structure is like this:

/index.html

/css/styles.css

(i.e. index.html inside a folder and next to it there's a folder named 'css', inside which style.css is.)

Then the html tag should be:

<link rel="stylesheet" href="/css/styles.css"> (notice the difference in the 'href' attribute value)

answered Jul 8 by Lovecode (640 points)
Thank you for such quick answer!
I actually used a wrong tag all together :)
0 votes
make sure your filename is correct and everything is in lowercase
answered Jul 8 by Lady Coder (140 points)
Lovecode logo
...