CSS TUTORIAL



CSS Comments


A comment in CSS is used as an aid in debug. Anything between the /* and */ in ignored by the browser. It is takes as a comment.

A single like comment starts with //

The example below shows the single line and multi line comment. The commenting system in CSS is similar to the common programming language including C and javascript.

<html>
<head>
<style type="text/css">
.blue
{
/* color:blue;
multi line comment */
color:red;
//color:green; 
}
</style>
</head>

<body>
<h1 class="blue">Center-aligned heading</h1>
<p class="blue">Center-aligned paragraph.</p> 
</body>
</html>


You can try this code using online tool here

As an exercise, try to un comment the last single line comment and comment the line

color:red;

And see its effect.

In the next page we will check some real life CSS styles. Make sure you are familar with them.