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

Summary of MySQL usage specifications

1. InnoDB storage engine must be used It has bett...

How to add conditional expressions to aggregate functions in MySql

MySQL filtering timing of where conditions and ha...

Example code for implementing bottom alignment in multiple ways with CSS

Due to the company's business requirements, t...

How to Set Shortcut Icons in Linux

Preface Creating shortcuts in Linux can open appl...

Detailed explanation of how MySQL (InnoDB) handles deadlocks

1. What is deadlock? The official definition is a...

Vue implements form validation function

This article mainly describes how to implement fo...

Solution to the Multiple primary key defined error in MySQL

There are two ways to create a primary key: creat...

js realizes a gradually increasing digital animation

Table of contents background Achieve a similar ef...

How to deploy and start redis in docker

Deploy redis in docker First install Docker in Li...

Building a selenium distributed environment based on docker

1. Download the image docker pull selenium/hub do...

Analysis of the process of deploying Python applications in Docker containers

Simple application deployment 1. Directory struct...

Canonical enables Linux desktop apps with Flutter (recommended)

Google's goal with Flutter has always been to...

Use Element+vue to implement start and end time limits

This article example shares the specific code for...

Implement QR code scanning function through Vue

hint This plug-in can only be accessed under the ...