How to Create Comment in HTML and CSS

How to Create Comment in HTML and CSS

Sometimes we need to don’t show some part in output but we do not want to delete in source code so we use to comment. In this article, you will learn How to Create Comment in HTML and CSS.

Comment in HTML

In HTML comment is use with the <!– –>

Example:-

<html>
<head>
<title>Comment in HTML</title>
</head>
<body>
<!-- This is a comment -->
<p>This is a paragraph.</p>
<!-- Comments are not displayed in the browser -->
</body>
</html>

Another Example:- 

<html>
<head>
<title>Comment in HTML</title>
</head>
<body>
<!-- Do not display this
<img src="image.jpg" alt="Hub of Tutorials">
-->
</body>
</html>

Comment in CSS

Example:-

<html>
<head>
<title>Comment in CSS</title>
<style>
/*
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}
*/
li a {
  display: block;
  width: 60px;
  background-color: #dddddd;
}
</style>
</head>
<body>
<ul>
  <li><a href="#home">Home</a></li>
  <li><a href="#news">News</a></li>
  <li><a href="#contact">Contact</a></li>
  <li><a href="#about">About</a></li>
</ul>
</body>
</html>

1 Comment

Leave A Reply