HTML Tutorial for Beginners: Structure, Tags, Headings, Paragraphs, Links, Images, and Tables
What is HTML?
HTML (HyperText Markup Language) is the standard language used to create and display content on web browsers.
It was developed by the World Wide Web Consortium (W3C).
- HTML uses markup tags to define the structure and format of content.
- Each HTML element usually has a start tag and an end tag:
<start-tag>Content</end-tag>
🔹 Basic Structure of an HTML Page
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<!-- Content goes here -->
</body>
</html>
Explanation:
<!DOCTYPE html> → Informs the browser that this is an HTML5 document.
<html> → Root element of an HTML page.
<head> → Contains meta-information, title, and links to styles/scripts.
<body> → Contains visible content like text, images, links, tables, etc.
🔹 Example 1: Displaying Text with Formatting
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<b>HTML is developed by W3C</b> <!-- Bold text -->
<i>W3C stands for World Wide Web Consortium</i> <!-- Italic text -->
<b>Inbuilt functions in HTML</b><br> <!-- Line break -->
<strong>Every HTML tag has a start tag and end tag</strong> <!-- Strong/Bold text -->
</body>
</html>
🔹 Example 2: Headings in HTML
HTML provides 6 levels of headings: <h1> to <h6>
<!DOCTYPE html>
<html>
<head>
<title>Headings Example</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
🔹 Example 3: Paragraphs
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<h1>Java Introduction</h1>
<p>
Java was developed by <b>Sun Microsystems</b>, currently acquired by
<mark>Oracle</mark>. <!-- Highlighted text -->
</p>
</body>
</html>
🔹 Example 4: Hyperlinks
<!DOCTYPE html>
<html>
<head>
<title>Link Page</title>
</head>
<body>
<a href="http://www.google.com">Google Home</a> <!-- Link to Google -->
</body>
</html>
🔹 Example 5: Images
<!DOCTYPE html>
<html>
<head>
<title>Image Example</title>
</head>
<body>
<img src="C:\Users\Md Arshad\Desktop\html\img.jpg"
alt="No Image Found"
width="500px"
height="500px">
</body>
</html>
🔹 Example 6: Tables
<!DOCTYPE html>
<html>
<head>
<title>Table Example</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
}
</style>
</head>
<body>
<table width="100%">
<tr>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
</tr>
<tr>
<td>Ram</td>
<td>Chennai</td>
<td>81224209319</td>
<td>ram@gmail.com</td>
</tr>
<tr>
<td>Shyam</td>
<td>Mumbai</td>
<td>987654321</td>
<td>shyam@gmail.com</td>
</tr>
</table>
</body>
</html>
Comments
Post a Comment