In the example above, the <!DOCTYPE html>
declaration specifies the version of HTML being used. The <html>
tag encloses the entire document. The <head>
tag contains meta information about the web page, such as the title. The <body>
tag contains the content of the web page.
Tip 5: Use proper indentation Proper indentation helps to make your HTML code easier to read and understand. Use a consistent number of spaces or tabs to indent your code.
Tip 6: Use comments
Use comments to explain your HTML code. Comments start with <!--
and end with -->
. They are not displayed in the browser, but can be useful for other developers who are reading your code. Here is an example:
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<!-- This is a heading -->
<h1>Welcome to my website!</h1>
<!-- This is a paragraph -->
<p>This is my first web page.</p>
</body>
</html>
I hope these tips and code examples will help you get started with writing HTML code at a beginner level. Good luck!
0 Comments