Follow The New Tutorial updates on WhatsApp, Telegram or YouTube.

CSS Comments

Comments are ignored by browsers.

CSS comments are generally written to explain your code.

Comments are single or multiple lines statement and written within /*…………*/ .

Comments can help document your source code. They make the program more readable and understandable.

Comments are used to explain the code.

You can add comments wherever you want in the code.

By design, comments have no effect on the layout of a document.

The commented code doesn’t execute.

Syntax

/* Comment */

The /* */ comment syntax is used for both single and multiline comments.

CSS Comments Example

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS Comments Example</title>

    <style>
        p {
            color: blue;
            /* This is a single-line comment */
            text-align: center;
        }

        /* This is  
        a multi-line  
        comment */
    </style>
</head>

<body>
    <p>Hello TheNewTutorial.com</p>
    <p>This statement is styled with CSS.</p>
    <p>CSS comments are ignored by the browsers and not shown in the output.</p>

</body>

</html>

The stuff inside the /* */ marks are CSS comments.