<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First Web Page</title>
<style>
html {
font-size: 20px;
}
body {
background-color: #333;
color: white;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first web page.</p>
</body>
</html>
<!DOCTYPE html>
: This is a document type declaration and informs the browser that the document is written in HTML5.
<html lang="en">
: The <html>
tag defines the root element of an HTML document. The lang
attribute specifies the language of the document, which in this case is set to English.
<head>
: The <head>
section contains meta-information about the HTML document, such as character encoding, title, and CSS stylesheets.
<meta charset="UTF-8">
: This meta tag sets the character encoding to UTF-8, which is the standard for handling international characters and symbols.
<title>My First Web Page</title>
: The <title>
tag sets the title of the web page that will be displayed in the browser’s title bar or tab.
<style>
: The <style>
tag is used to define inline CSS styles for the HTML document.
html {}
: This is a CSS selector that targets the html
element. In this case, it sets the font size to 22 pixels.
body {}
: This CSS selector targets the body
element and sets the background color to #333
(a dark gray) and the text color to white
.
<body>
: The <body>
tag encloses the content of the web page that will be displayed in the browser.
<h1>Hello World!</h1>
: This is a level 1 heading element (<h1>
) that displays the text “Hello World!” as a heading on the web page.
<p>This is my first web page.</p>
: This is a paragraph element (<p>
) that displays the text “This is my first web page.” as a paragraph on the web page.
The code provided creates a simple web page with a dark gray background, white text color, and a heading that says “
Hello World!” followed by a paragraph of text.