HTML – Comments

The HTML comment element is use to add a comment to an HTML document. In HTML document comment elements use to disable code of a page, which you are testing but that is not ready yet. The HTML comment elements begin with <!–– and the comment closes with ––>.

The HTML comment elements are not displayed in the web browser, its use to insert comment in the source code. Follow the HTML comments properly use in your HTML document. For example:

1

2

3

4

5

6

7

8

9

<!DOCTYPE html>

<html>

<head>

<title>HTML–Comments</title>

</head>

<body>

<p><!--thistag useforparagraph line--></p>

</body>

</html>

Multiline Comments

Use HTML comment elements you can comment multiple lines text of a HTML page. Comment multiple line text start <!– tag and end –> tag and place text in this tag.

HTML comment can span multiple line in you HTML document.

Informative text comments when you explain to the code.

Multiline Comments example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

<!DOCTYPE html>

<html>

<head>

<title>Multiline Comments</title>

</head>

<body>

<!--

Thisisamultiline comment andit can

span through asmany aslines you like.

-->

</body>

</html>

Conditional Comments

HTML conditional comments are nothing more than simple HTML comments that will be picked up by Internet Explorer.

Conditional comments only work in IE.

Comments between <!–[if IE]> and <![endif]–>.

A conditional comment block that is ignored by down-level browsers.

Conditional Comments example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

<!DOCTYPE html>

<html>

<head>

<title>Conditional Comments</title>

<!--[ifIE6]>

Special instructions forIE6here

<![endif]-->

</head>

<body>

<p>Page content goes here.....</p>

</body>

</html>

Using Comment Tag

HTML comment tag represents to insert comment in the source HTML code. The HTML comment tag supports few browsers and its start with <comment> tag and end with </comment> tag.

Commenting Script Code

You must make a note that if you are using Java Script in your HTML code. You will give a comment in Java Script using HTML comment. It is recommended to put that script code inside proper HTML page comments.

Example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

<!DOCTYPEhtml>

<html>

<head>

<title>CommentingScriptCode</title>

<script>

<!--

document.write("Script Code comment")

//-->

</script>

</head>

<body>

<p>Script Code comment</p>

</body>

</html>

Commenting Style Sheets

You will learn Style Sheet with HTML for make page document another format and make some design. In HTML you must make a note that if you are using CSS in your HTML document. It is recommended to put that style sheet code inside proper HTML comments.

Hi
Do you want to make web application with php and php framework(CI, Laravel)? Want to make android application with hybrid framework ?
Then contact with us.
We provide support for developing website and web application at very affordable price.
E-Mail us at: dataflow1117@gmail.com