包括:HTML、CSS、php、JavaScript
HTML注释
注意:html 注释标签和其它语言的注释不一样。比如:JavaScript、php等语言都有单行注释和多行注释,但是 html 注释标签只有一个,单行和多行都是使用同一个标签来注释。
注意: 注释中可以直接使用回车换行。
并且我们习惯用注释的标签把HTML代码包裹起来。如:
这里放你xx部分的HTML代码
HTML注释的注意事项:
HTML注释不支持嵌套。
HTML注释不能写在HTML标签中
建议:
注释的内容两边留个空格
不好:
推荐:
多行注释:
范例:来源于wordpress 2020主题:
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since 1.0.0
*/
PHP
单行注释
单行注释有两种方式,分别是使用“#”和反斜杠“//”。
// 这是单行注释
# 这也是单行注释
提示:单行注释中使用最广泛是使用双斜杠“//”来定义注释。
多行注释块
/*
这是多行注释块
它横跨了
多行
*/
提示:多行注释不能相互嵌套使用。
当然,这种方式也可以作为单行注释使用
/* echo "PHP 注释"; */
CSS
JS