Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebug reporting CSS syntax error at beginning of external stylesheet

Firebug complains about a syntax error in one of my external CSS files and always blames the first line: SyntaxError: syntax error

For testing purposes I tried to comment out and remove the first rule completely, but the error is still displayed for the next rule. All style sheets in the file are ignored.

screenshot of Firebug error message

like image 317
peterp Avatar asked Dec 09 '22 11:12

peterp


1 Answers

Actually this is a JavaScript syntax error, not a CSS problem. This happens when absent-mindedly copy-pasting HTML tags and including a CSS file using a script tag. D'oh!

Actually, the browser tries to parse the CSS content as JavaScript, which of course does not work. The solution is simple:

<script src="style.css"></script> <!-- won't work -->
<link rel="stylesheet" type="text/css" href="style.css"/> <!-- better :) -->
like image 127
peterp Avatar answered Apr 16 '23 18:04

peterp