PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, December 12, 2022

[FIXED] What is the syntax for adding comments in CSS?

 December 12, 2022     comments, css, syntax     No comments   

Issue

In how many ways and places can we place comments in CSS?

Can the placement of comments create any problems in CSS rendering and validation?


Solution

The CSS specification spells this out definitively:

Comments begin with the characters /* and end with the characters */. They may occur anywhere between tokens, and their contents have no influence on the rendering. Comments may not be nested.

CSS also allows the SGML comment delimiters (<!-- and -->) in certain places defined by the grammar, but they do not delimit CSS comments. They are permitted so that style rules appearing in an HTML source document (in the STYLE element) may be hidden from pre-HTML 3.2 user agents. See the HTML 4 specification ([HTML4]) for more information.

For example:

.row {background-color:#FFF;}  /* normal */
.row:hover {background-color:#CCC; /* grayed background */}
 
/* the title class */
.title{
    /* make font bigger */
    font-size: 160%;
}


Answered By - Greg Hewgill
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing