Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically write html structure

I am using visual studio code .I have the php extension installed already . But it is very repetitive to create each php file with the base structure like this one . Since it does'nt automatically insert it for me .

<!DOCTYPE HTML >
<HTML lang="en">
   <HEAD>
      <TITLE></TITLE>
   </HEAD>
   <BODY>
   </BODY>
</HTML>

Is there anyway or short key to quickly copy this structure into the newly created php file ? without using control+C control+V from a note ?

like image 996
黃兆榮 Avatar asked Aug 31 '25 18:08

黃兆榮


1 Answers

If you are using VS code then you can use this command shift + 1 and enter to auto-populate HTML Doctype in HTML or PHP.

enter image description here

When you will press enter it will add the following code:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

like image 129
Abdullah Khan Avatar answered Sep 02 '25 11:09

Abdullah Khan