HTML Document Example








Certainly! Here's an example of a basic HTML document with the <!DOCTYPE html> declaration:htmlCopy code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My HTML Document</title> </head> <body> <h1>Hello, World!</h1> <p>This is a basic HTML document.</p> </body> </html>


In this example, the <!DOCTYPE html> declaration is placed at the very beginning of the document, before the <html> tag. It informs the web browser that the document is written in HTML5, the latest version of HTML.

The rest of the code includes the basic structure of an HTML document, with the <html> tag encapsulating the entire document. Inside the <html> tag, we have the <head> and <body> sections.

The <head> section contains meta information about the document, such as the character encoding (<meta charset="UTF-8">) and the viewport settings (<meta name="viewport" content="width=device-width, initial-scale=1.0">). It also includes the <title> element, which sets the title of the webpage displayed in the browser's title bar.

The <body> section is where the visible content of the webpage resides. In this example, we have a heading <h1> element that displays "Hello, World!" and a paragraph <p> element that contains some text.

Remember to save this code with a .html extension (e.g., index.html) and open it in a web browser to see the rendered output