HTML and CSS Certification Practice Test 2025 – The All-in-One Guide to Master Your Certification!

Question: 1 / 400

How do you insert a comment in CSS?

<!-- comment -->

/* comment */

In CSS, the appropriate way to insert a comment is by using the syntax that begins with a forward slash and an asterisk and ends with an asterisk and a forward slash. This format is denoted as /* comment */. Any text placed between those markers will be treated as a comment and will not be rendered or affect the styling of the web page.

Using the correct comment syntax helps keep your stylesheets organized and readable, allowing developers to add notes or explanations about certain styles without affecting the actual CSS code. For example, you might explain why a specific style is applied or leave reminders about future modifications.

The other options represent comment syntaxes from other languages; for instance, HTML comments begin with <!-- and end with -->, while languages like JavaScript use // for single-line comments. The notation /*! comment */ in CSS is valid but is specifically used for special purposes such as indicating that a comment is preserved in minified files, which is not the typical case for standard commenting.

Get further explanation with Examzify DeepDiveBeta

// comment

/*! comment */

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy