Saturday, May 19, 2012
Forum Minimize
 
Web Development & Design ForumWeb Development & Design ForumCSS & HTML Desi...CSS & HTML Desi...GeneralGeneralCSS Syntax DetailsCSS Syntax Details
Previous Previous
 
Next
 Disabled
New Post
 10/2/2010 9:38 AM
 
The key points of CSS syntax are as follows:
  • Unicode UTF-8 should be used to encode CSS Files - the same way you should encode HTML files.
  • CSS code should be lowercase. Selectors are case sensitives when referencing element names, classes, attributes, and IDs in XHTML. CSS properties and values are case insensitive.
  • Element names, classes, and IDs are restricted to letters, numbers, underscores (_), hyphens(-), and Unicode characters 161 and higher. The first character of an element, class, or ID must not be a number or a hyphen. A classname and ID must not contain punctuation other than the underscore and hyphen.
  • Mulitple classes can be assigned to an element by separating each class name with a space, such as class="class1 class2 class3".
  • Constant values should not be placed in quotes. For example, color:black; is correct, but color:"black"; is not.
  • The backslash (\) can be used to embed characters in a context where they normally cannot occur; for example, \26b embeds & in a string or identifier. Anywhere from two to eight hex codes can follow a backslash, or a character can follow a backslash.
  • A string may contain parentheses, commas, whitespace, single quotes ('), and double quotes (") as long as they are escaped with a backslash.
  • A semicolon should terminate each CSS rule and @import statement.
  • Rulesets are created by enclosing multiple rules in curly braces.
  • A CSS comment starts with /* and ends with */. Comments cannot be nested. Thus, the first time a browser encounters */ in a stylesheet, it terminates the comment.
Previous Previous
 
Next
 Disabled
Web Development & Design ForumWeb Development & Design ForumCSS & HTML Desi...CSS & HTML Desi...GeneralGeneralCSS Syntax DetailsCSS Syntax Details

spacer