First Website + DocType


Creating your first website

Creating your first website is really easy stuff. Work down on the following steps –

1. Open a folder in VS Code
2. Create an “index.html” file
3. Write something in this file and save it
4. Open this file in your web browser to view the output

This however is not the correct way to build web pages. In the upcoming lectures, we shall see what the correct way is.

DocType

The DOCTYPE declaration is an instruction that informs the web browser about the version of HTML in which the web page is written.

The DOCTYPE declaration is typically placed at the beginning of an HTML document before the <html> tag. It is not an HTML tag itself, but rather an instruction for the web browser to understand how to parse the web page.

The DOCTYPE declaration is important because it helps the web browser to render the web page correctly. Different versions of HTML have different rules and syntax, so it’s essential to specify the correct DOCTYPE to ensure that the web page is rendered properly.

A sample HTML boilerplate 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>