Search code examples
visual-studio-code

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 ?


Solution

  • 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>