Html comments Symbols for marking text comments in Html

Html comments Symbols for marking text comments in Html

HTML comments, we often need to make some HTML comments next to some codes. There are many benefits to doing so, such as: convenient search, convenient comparison, convenient for other programmers in the project team to understand your code, and convenient for you to understand and modify your own code in the future, etc.

HTML comments start with <!-- and end with -->

HTML Comment Syntax

<!--Comment content-->

Example


Copy code
The code is as follows:

<!--Comments here-->
<a href="https://www.jb51.net">123WORDPRESS.COM</a>
<!--End of link-->

Here is a more complete list for you


Copy code
The code is as follows:

1. <!--Comment content-->
2. //Comment content (insert single-line comments in CSS or JavaScript)
3. /*Comment content*/ (insert multiple lines of comments in CSS or JavaScript)


JavaScript Comments

JavaScript Comment Syntax


Copy code
The code is as follows:

//Comment content
/*
Note content
*/


CSS Comments

As described in the HTML tutorial, comments also play an important role in CSS documents, helping us remember the meaning of CSS, where it is loaded in the HTML document, etc.

CSS comments start with /* and end with */

CSS Comment Syntax


Copy code
The code is as follows:

/* Comment content*/
Example
/* ----------Beginning of text style---------- */
/* White 12 pixel text*/
.dreamduwhite12px
{
color:white;
font-size:12px;
}
/* Black 16 pixel text*/
.dreamdublack16px
{
color:black;
font-size:16px;
}
/* ----------End of text style---------- */


JavaScript Comment Example

Use two double slashes to comment a line

[code]
//document.write("www.jb51.net");
Use slash star to comment code blocks (multi-line)

/*
var jb51 = "www.jb51.net";
var jb51 = "du";
*/
[html]

Tip: Too many JavaScript comments will slow down the execution and loading speed of JavaScript, so JavaScript comments should be removed when publishing the website.

Tip: You cannot use (/* or */, which may be generated in JavaScript regular expressions) in the comment block (/* ... */). This will cause syntax errors, so I recommend that you use // as the comment code. In this tutorial, // will be used to mark comments.

<<:  jQuery Ajax chatbot implementation case study

>>:  Detailed explanation of display modes in CSS tags

Recommend

Jenkins builds Docker images and pushes them to Harbor warehouse

Table of contents Dockerfile pom.xml Jenkins Conf...

Complete steps to install Anaconda3 in Ubuntu environment

Table of contents Introduction to Anaconda 1. Dow...

Multiple methods to modify MySQL root password (recommended)

Method 1: Use the SET PASSWORD command MySQL -u r...

Vue implements dynamic query rule generation component

1. Dynamic query rules The dynamic query rules ar...

Summary of three rules for React state management

Table of contents Preface No.1 A focus No.2 Extra...

Detailed explanation of the use of stat function and stat command in Linux

stat function and stat command Explanation of [in...

Have you carefully understood Tags How it is defined How to use

Preface : Today I was asked, "Have you carefu...

MySQL sorting principles and case analysis

Preface Sorting is a basic function in databases,...

How to use cc.follow for camera tracking in CocosCreator

Cocos Creator version: 2.3.4 Demo download: https...

Simple use of Vue vee-validate plug-in

Table of contents 1. Installation 2. Import 3. De...

jQuery implements breathing carousel

This article shares the specific code of jQuery t...

In-depth understanding of Worker threads in Node.js

Table of contents Overview The history of CPU-bou...

Linux Autofs automatic mount service installation and deployment tutorial

Table of contents 1. Introduction to autofs servi...