0
0
CSSmarkup~5 mins

Comments in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the syntax for writing a comment in CSS?
A CSS comment starts with /* and ends with */. Anything between these markers is ignored by the browser.
Click to reveal answer
beginner
Can CSS comments be placed inside a CSS rule or only outside?
CSS comments can be placed anywhere in the CSS file, including inside CSS rules, between properties, or outside rules. They do not affect the styles.
Click to reveal answer
beginner
Why should you use comments in your CSS code?
Comments help explain your code to yourself and others. They make it easier to understand, maintain, and update styles later.
Click to reveal answer
beginner
Are CSS comments visible on the webpage when viewed in a browser?
No, CSS comments are not shown on the webpage. They are only visible in the CSS source code and ignored by the browser when rendering.
Click to reveal answer
intermediate
What happens if you forget to close a CSS comment?
If a CSS comment is not closed with */, the browser will treat the rest of the CSS file as a comment, causing styles to break or not apply.
Click to reveal answer
Which of the following is the correct way to write a CSS comment?
A// This is a comment
B<!-- This is a comment -->
C/* This is a comment */
D# This is a comment
Can CSS comments be placed between CSS properties inside a rule?
AOnly at the end of the CSS file.
BYes, comments can be placed anywhere in CSS.
COnly at the start of the CSS file.
DNo, comments can only be outside rules.
What will happen if you forget to close a CSS comment?
AThe browser ignores the rest of the CSS file.
BThe comment closes automatically.
CThe CSS file will work normally.
DThe browser shows an error message.
Are CSS comments visible on the webpage when viewed by users?
ANo, they are only in the source code.
BYes, they appear as text on the page.
COnly in some browsers.
DOnly if you use special tags.
Why is it good to use comments in CSS?
ATo hide CSS from browsers.
BTo make the page load faster.
CTo change the color of text.
DTo explain code and make it easier to maintain.
Explain how to write a comment in CSS and why it is useful.
Think about how comments help you understand your own notes later.
You got /4 concepts.
    Describe what happens if a CSS comment is not properly closed.
    Imagine leaving a note open without an ending.
    You got /3 concepts.