Tech
Here’s an example of a basic HTML code structure
Here’s an example of a basic HTML code structure
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page!</h1>
<p>This is a paragraph of text.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<img src="image.jpg" alt="Image">
<a href="https://www.example.com">Click here</a> to visit an external link.
</body>
</html>
Let me briefly explain the different elements:
<!DOCTYPE html>
: This declaration specifies that the document is an HTML5 document.<html>
: The root element of an HTML page.<head>
: Contains metadata and other information about the HTML document.<title>
: Sets the title of the webpage, which appears in the browser’s title bar or tab.<body>
: The container for the visible content of the webpage.<h1>
: A heading element. There are six levels of headings, from<h1>
to<h6>
.<p>
: A paragraph element for text content.<ul>
and<li>
: Used to create an unordered list.<li>
represents each list item.<img>
: Inserts an image into the webpage. The ‘src
‘ attribute specifies the image file path, and thealt
attribute provides alternative text for accessibility.<a>
: Creates a hyperlink. Thehref
attribute specifies the target URL.
Remember to save the code with a .html
extension, such as index.html
, and open it in a web browser to see the rendered output.