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.


/* Comment */

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

CSS Comments Example

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

    <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>

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

        /* This is  
        a multi-line  
        comment */

    <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>



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