'First Few Lines of CSS Not Working?
I'm currently fourteen years, and I've been trying to learn HTML and CSS over the past month. I've gotten the hang of things and tried to make my own website. I am a huge fan of League of Legends, so I decided to make it about that. Everything is coming along beautifully, but I've encountered a problem with the CSS. I'm using an internal style sheet. For some odd reason, the first syntax isn't working. Everything else functions properly.
This is the link to my website
(Right click and press view page source to look at code)
According to css code, all listed items should be the color #0000CD. However, nothing is happening. Can someone tell me what I did wrong and how to fix it?
Solution 1:[1]
In the <style>
node remove the HTML comment : <!---Begin CSS--->
It breaks your CSS. A real CSS comment is like this : /* I am a comment */
Solution 2:[2]
Remove those comments <!---Begin CSS--->
<!---End CSS--->
, and use the comments (/*Begin CSS*/
) before <style>
and after </style>
(/*End CSS*/
).
Solution 3:[3]
You made an html comment in your css. <!---Begin CSS--->
should say this instead /* Begin CSS */
Besides that you shouldn't have your css in your html file. Instead in between your <head>
and </head>
have this <link rel="stylesheet" href="css/example.css">
where example.css is your css file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arnaud Gueras |
Solution 2 | Kevin Andrid |
Solution 3 | Nick Graeff |