DelphiFAQ Home Search:

FireFox error "Selector expected. Ruleset ignored due to bad selector"

 

comments7 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

Question:

The javascript-console of FireFox gives me these errors:

Error: Selector expected. Ruleset ignored due to bad selector.

followed by

Error: Unexpected end of file while searching for closing } of invalid rule set.

Do you have any ideas on what this means and how to resolve it?

Answer:

Review your .CSS style sheet file. You probably have HTML comments in there, similar to what people put in Javascript sections. Remove those comments as shown below.

// this will cause an error in Firefox:

    <style>
    <!--
       .styling { blah... }
    //-->
    </style>


// this is ok:

    <style>
       .styling { blah... }
    </style>

Comments:

2006-11-14, 09:32:06
anonymous from United States  
Where's the .CSS style sheet file located?
2007-01-28, 03:55:42
anonymous from United Kingdom  
I get that warning, but dont have any //-> in my style sheet ( http://www.bandsman..style.css)
2007-01-28, 09:27:06   (updated: 2007-01-28, 09:27:22)
Peter,(Admin) from United States  
To anonymous in United Kingdom:

I looked at your CSS file. If it is an external .css file, you should not include the <style> and </style> lines.
2007-02-06, 09:00:08
anonymous from United States  
Hey that worked. Thanks.
2007-07-17, 22:46:56
anonymous  
rating
When you are put an semicolon after the } in the styles(like this

.stylename{
width:10%
};

) at that time also this error will come. Just remove the semicolon then it will works

use this(
.stylename{
width:10%
}

)
2007-09-20, 15:43:52   (updated: 2007-09-20, 15:44:42)
anonymous from Porto Alegre, Brazil  
You may also have something like this in your CSS:

.whatever, {
...
}

The extra comma shouldn't be there, so just remove it:

.whatever {
...
}
2007-09-21, 12:41:08
anonymous from United States  
I actually got this error because I named one of my classes starting with a number:

<style type='text/css' >
.100Percent
{
    width: 100%;
}
</style>

When I changed it to the following the error went away:

<style type='text/css' >
.OneHundredPercent
{
    width: 100%;
}
</style>

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
Leave your comment here:
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.