Reputation: 17770
Is there any guideline for having no space between rules? Is it ok to have no space like the following:
#Ellipse_1 {
fill: rgba(0,157,255,1);
cursor: context-menu;
}.Ellipse_1 {
overflow: visible;
}
In my test it seems to work in Firefox and Chrome browsers.
Upvotes: 0
Views: 102
Reputation: 943591
The CSS grammar is described in the specification:
stylesheet : [ CDO | CDC | S | statement ]*; statement : ruleset | at-rule; at-rule : ATKEYWORD S* any* [ block | ';' S* ]; block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; selector : any+; declaration : property S* ':' S* value; property : IDENT; value : [ any | block | ATKEYWORD S* ]+; any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES | DASHMATCH | ':' | FUNCTION S* [any|unused]* ')' | '(' S* [any|unused]* ')' | '[' S* [any|unused]* ']' ] S*; unused : block | ATKEYWORD S* | ';' S* | CDO S* | CDC S*;
White space (S
) is optional (*
) after the }
at the end of a ruleset. A ruleset is a type of statement. A stylesheet can consist of a series of statements.
There's no requirement for whitespace between them.
That said, whitespace aids readability so you should include it when writing CSS. (Minified CSS for production is another story).
Upvotes: 4