Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make HTML code inactive with comments

Tags:

html

xhtml

I have some HTML code on a page that I don't want to erase, but make inactive for the short term. How can I make the browser ignore parts of the page in the same way the // works in some programming languages?

like image 987
Quazi Avatar asked Dec 09 '10 00:12

Quazi


People also ask

How do I disable comments in HTML?

To make a comment line or select the code, right click -> Source -> Add Block Comment. To remove the block comment, Ctrl + Shift + \ or right click -> Source -> Remove Block comment.

How do I make HTML code inactive?

Type "---" followed by ">" (no quotes and no spaces) at the end of the block of text you want to hide. This closed comment tag ensures that the HTML code between the open comment tag and this point will be hidden when viewed with an Internet browser.

How do you hide content in HTML?

To hide an element, set the style display property to “none”. document.


2 Answers

Behold HTML comments:

<!-- comment -->

http://www.w3.org/TR/html401/intro/sgmltut.html#idx-HTML

The proper way to delete code without deleting it, of course, is to use version control, which enables you to resurrect old code from the past. Don't get into the habit of accumulating commented-out code in your pages, it's no fun. :)

like image 169
deceze Avatar answered Oct 20 '22 10:10

deceze


HTML Comments:

<!-- <div> This div will not show </div> -->

See Reference

CSS Comments:

/* This style will not apply */

See Reference

JavaScript Comments:

// This single line JavaScript code will not execute

OR

/*
   The whole block of JavaScript code will not execute
*/

See Reference

like image 32
Ahsan Khurshid Avatar answered Oct 20 '22 10:10

Ahsan Khurshid