Tag Archives: Comment

Be careful when adding Comment to your code in CSS

3 Sep

Why,

Because,I have spent a full day with the small mess.

The small mistake in CSS Kills my Productivity (God! I got the solution and I am here sharing my experience so you won’t to that mistake).

What I did?

  • CSS works perfectly in IE when I use the below code
<!- - This is my Commnet - ->

body {background-color:red;}

#my_id { background-color:green;}
  • But in Firefox the next line of style below the comment won’t work

Say, I have added comments in each CSS files like this.


<!- - This is my Commnet - ->

body {background-color:red;}

#my_id { background-color:green;}

Where the body {background-color:red;} not seems to be working, at first I am too confused …after long battle zzzzz… I found the solution friends!.

The Solution is

  • We have to write comments as follows.

/*Comment Line*/

body{ background-color : red;}

To Conclude, IE and other Browsers accepts this comment format<!- – comment- ->,but the correct format to comment is /*Comment Line*/


<!- - This is my Commnet - ->

body {background-color:red;}

#my_id { background-color:green;}

Suggestion: Please stick with the CSS basics, mainly we developers are keen in coding where we work with major CMSs like WordPress, Joomla, than the design.So we are not spending time to learn and remember the very basics.