TOP CATEGORIES

×

How to comment HTML code?

O

OMi Shanya

HTML Comment

HTML comment used to hide the code when the bowers will respond to the result because the HTML commented code is visible in the HTML page BUT the browser is not able to access all commented code. There are multiple types of comment code used to comment HTML page code such as:

  • Single Line Comment
  • Multiple Line Comment

Basic HTML Comment Syntax Type

  1. HTML Code (Comment for All code in HTML code for multiple Line)
  2. Comment Syntax For One Line Script Code in HTML Page
  3. Comment Syntax For One-Line CSS Style Code in HTML Page

HTML Code (Comment) Syntax

<! --  Write HTML Code Here, "Which code you want comment" -->

FOR EXAMPLE

<p> This is my first paragraph. </p> // Paragraph is not commented

<! -- <p> This is my first paragraph. </p> --> // Now, Paragraph is commented

One Line Script Code (Comment) Syntax

// Commented Script Code 

FOR EXAMPLE

function hello()  (It's not commented)

// function hello ()  (Now, It's commented)

One-Line CSS Style Code (Comment) Syntax

/*  Commented Script Code  */

FOR EXAMPLE

Uncomment CSS Code style

. hello {

 color: green;

 backgraund-color: red;

}

Comment CSS Code style

. hello {

 /* color: green; */

 backgraund-color: red;

}

Here, the color code of hello class is commented that's why it will not going to work now.

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)