CSS Comments
Comments are added to the source code to easily understand the code. It helps the other developer or programmer to understand the code (written by another developer) easily. Just like Html, comments are also written in CSS.
There are two types of comments in CSS: -
- Single Line Comments: - These types of comments written only in one line.
- Multi Line Comments: - These types of comments are written in one or more lines.
Note :- Comments are ignored by the browser and would not be display as output.
Example of Comments
<html>
<head>
<title> Example of CSS Syntax </title>
<style>
h1{ /* This style is given to the heading tag only they didn't work on paragraph tag. */
color: Red;
background-color: Yellow;
text-align: center;
}
p { /* This style is given to the
paragraph tag only
they didn't work on heading tag.
*/
color: Yellow;
background-color: green;
text-align: center;
}
</style>
</head>
<body>
<h1> This is a Heading. </h1>
<p> This is a Paragraph. </p>
<div class="container">
<p> This is a paragraph tag under the div. </p>
</div>
</body>
</html>
<head>
<title> Example of CSS Syntax </title>
<style>
h1{ /* This style is given to the heading tag only they didn't work on paragraph tag. */
color: Red;
background-color: Yellow;
text-align: center;
}
p { /* This style is given to the
paragraph tag only
they didn't work on heading tag.
*/
color: Yellow;
background-color: green;
text-align: center;
}
</style>
</head>
<body>
<h1> This is a Heading. </h1>
<p> This is a Paragraph. </p>
<div class="container">
<p> This is a paragraph tag under the div. </p>
</div>
</body>
</html>
Output: -
0 comments:
Post a Comment