Connect with us

CSS

How do you Add a Comment in a CSS file?

HIow do you add a comment in a css file
Spread the love

"How do you add a comment in a css file?" If you are looking for the answer for this question, you will find it in this article with an easy explanation.

Comments are used for explaining the code that will help the developers to future understand the code.

Comments can be added at any place within the CSS <style> section or within external CSS file.

Comments are ignored by the compiler & are not visible in the browser.

How do you add a comment in a CSS file?

CSS Syntax :-

	<style>
	.body {
		padding: 10px 0 10px 0;
		background-color: gold; 
		/* This is Single line comment.*/
	}
	</style> 

Single-line comment in CSS begins with /* and ends with */.

Single-line comments are useful for a quick description of the important code.

Comments are useful for understanding the code & can save a lot of time for developers.

How do you add multi-line comments in a CSS file?

CSS Syntax :-

	<style>
	/*
	Multi-line comments can be added
	in this way.
	*/
	.body {
		padding: 10px 0 10px 0;
	}
	</style> 

Multi-line comment in CSS begins with /* and ends with */.

Within this block, Comments can be added in multiple lines.

Multi-line comments provide a way to expand the description of the code.

Conclusion

Hope you have understood & received the clear explanation for your query "How do you add a comment in a css file".

You can comment below should you have any more queries on this topic.


Spread the love
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *