To run a basic website using HTML, you don’t need a lot of code—just the essential structure of an HTML document. Here’s a simple example:
<!DOCTYPE html>
<html>
<head>
<title>My First Website</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a basic HTML page.</p>
</body>
</html>
Explanation of the main parts:
<!DOCTYPE html> → Tells the browser this is an HTML5 document.
<html>...</html> → The root element that contains everything.
<head>...</head> → Holds metadata (title, styles, scripts, SEO info, etc.).
<title> → The text shown on the browser tab.
<body>...</body> → The actual content that users see (text, images, links, etc.). With just this, you can save the file as index.html and open it in any browser—it will run as a website. If you want to make it look nicer, you’d add CSS (for styling) and JavaScript (for interactivity), but the above code is the foundation every website starts with.