我们在编写前端页面时,常希望能自动生成基础的HTML代码。而在Sublime和VSCode就有这样的功能
在Sublime中,在编辑栏输入html,然后敲Tab键,则自动生成代码如下:
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title></title>
5 </head>
6 <body>
7
8 </body>
9 </html>
在VSCode中,在编辑栏输入!,然后敲Tab键,则自动生成代码如下:
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta http-equiv="X-UA-Compatible" content="ie=edge">
7 <title>Document</title>
8 </head>
9 <body>
10
11 </body>
12 </html>
lang="en"表示此页面为英文页面,在Chrome浏览器中可以对其进行翻译。
若lang="zh"表示此页面为中文页面,在Chrome浏览器中无法对其进行翻译。
<meta http-equiv="X-UA-Compatible" content="ie=edge">是对IE浏览器的不同版本进行兼容。