0 votes
380 views
by (1.1k points)
What are main codes for HTML to run the website?

3 Answers

0 votes
by (240 points)

The HTML document it self begins with <html> and ends with </html>.

The visible part of the HTML document is between <body> and </body>.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>

0 votes
by (960 points)

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.

0 votes
by (180 points)
HTML uses essential codes like <html>, <head>, <title>, <body>, <h1>-<h6>, <p>, <a>, <img>, <div>, <span> to structure and display a functional website.
...