HTML Basic in Tamil
தமிழில் HTML Basic Examples கற்றுக்கொள்ளுங்கள். Headings, Paragraphs, Links, Images, Buttons மற்றும் Attributes-க்கான Practical Code Examples.
முந்தைய Chapter-இல் HTML File உருவாக்குவது, Save செய்வது மற்றும் Browser-இல் Open செய்வது பற்றி அறிந்துகொண்டீர்கள்.
இப்போது Practical Examples மூலம் HTML கற்றுக்கொள்வோம்!
இந்த Chapter-இல் Basic HTML Document, Headings, Paragraphs, Links, Images, Buttons மற்றும் பிற பொதுவான HTML Elements பயன்படுத்துவதைக் கற்றுக்கொள்வீர்கள்.
A Basic HTML Document
ஒரு சாதாரண HTML Page-இன் Structure பின்வருமாறு இருக்கும்.
Example:
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to W3PrimeCode</h1>
<p>This is my first HTML page.</p>
</body>
</html>Code Explanation
| Code | விளக்கம் |
|---|---|
| \<!DOCTYPE html> | Document HTML5 பயன்படுத்துவதாக அறிவிக்கிறது. |
| \<html> | HTML Document-இன் Root Element. |
| \<head> | Document Metadata-ஐக் கொண்டுள்ளது. |
| \<title> | Browser Tab Title-ஐ வரையறுக்கிறது. |
| \<body> | முக்கிய Visible Content-ஐக் கொண்டுள்ளது. |
| \<h1> | Top-level Heading உருவாக்குகிறது. |
| \<p> | Paragraph உருவாக்குகிறது. |
HTML Headings
HTML-இல் <h1> முதல் <h6> வரை ஆறு Heading Levels உள்ளன.
<h1> மிக உயர்ந்த Level-ஐயும் <h6> மிகக் குறைந்த Level-ஐயும் குறிக்கிறது.
Example:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>Expected Output: Browser ஆறு Headings-ஐயும் அவற்றின் Default Styles-க்கு ஏற்ப காட்டும்.
Important: Font Size மாற்றுவதற்காக மட்டும் Headings பயன்படுத்த வேண்டாம். Content Hierarchy-க்கு ஏற்ப Heading Level தேர்ந்தெடுக்கவும்.
HTML Paragraphs
<p> Element மூலம் Paragraph உருவாக்கலாம்.
Example:
<p>This is my first paragraph.</p>
<p>This is my second paragraph.</p>Browser பொதுவாக Paragraphs-ஐ தனித்தனி Blocks ஆகக் காட்டும்.
HTML Links
HTML Links மூலம் ஒரு Page-இலிருந்து மற்றொரு Page அல்லது Resource-க்குச் செல்லலாம்.
Link உருவாக்க <a> Element பயன்படுத்தப்படுகிறது.
Syntax:
<a href="URL">Link Text</a>Example:
<a href="https://www.example.com">
Visit Example Website
</a>இங்கு href Attribute, Link Destination-ஐ வரையறுக்கிறது. Visit Example Website என்பது Clickable Text ஆகும்.
HTML Images
Web Page-இல் Image சேர்க்க <img> Element பயன்படுத்தப்படுகிறது.
Example:
<img
src="https://www.w3.org/Icons/w3c_home"
alt="W3C Logo"
width="100"
>Expected Output: Image Resource கிடைத்தால் Browser W3C Logo-ஐக் காட்டும்.
| Attribute | பணி |
|---|---|
| src | Image Location-ஐ வரையறுக்கிறது. |
| alt | Image-க்கான Text Alternative வழங்குகிறது. |
| width | Image-இன் Display Width-ஐ வரையறுக்கிறது. |
alt Attribute Accessibility-க்கு முக்கியமானது. Image காட்டப்படாதபோதும் அதன் Content அல்லது நோக்கத்தைப் புரிந்துகொள்ள உதவுகிறது.
<img> ஒரு Void Element. இதற்கு Closing Tag தேவையில்லை.
HTML Buttons
Button உருவாக்க <button> Element பயன்படுத்தப்படுகிறது.
Example:
<button type="button">Click Me</button>Expected Output: Click Me என்ற Text கொண்ட Button தோன்றும்.
இந்த Button தனியாக எந்த Custom Action-ஐயும் செய்யாது. பின்னர் JavaScript மூலம் Interactivity சேர்க்கலாம்.
HTML Line Breaks
<br> Element, Text-இல் Line Break சேர்க்கிறது.
Example:
<p>
Hello World!<br>
Welcome to HTML.
</p><br> ஒரு Void Element ஆகும். Page Layout-இல் Spacing உருவாக்க மீண்டும் மீண்டும் <br> பயன்படுத்துவதற்குப் பதிலாக CSS பயன்படுத்தவும்.
HTML Horizontal Rules
<hr> Element, Content-இன் இரண்டு Sections இடையே Thematic Break-ஐக் குறிக்கிறது.
Example:
<h2>HTML Tutorial</h2>
<p>Learn HTML step by step.</p>
<hr>
<h2>CSS Tutorial</h2>
<p>Learn how to style web pages.</p>Expected Output: Browser பொதுவாக இரண்டு Sections இடையே Horizontal Line-ஐக் காட்டும்.
HTML Attributes
HTML Attributes, Element-க்கு கூடுதல் தகவல் அல்லது Configuration வழங்குகின்றன.
Syntax:
<tagname attribute="value">Content</tagname>Example:
<a href="https://www.example.com">Visit Website</a>இங்கு href ஒரு Attribute ஆகும்.
மற்றொரு Example:
<p title="This is a tooltip">
Move your mouse over this paragraph.
</p>பல Desktop Browsers-இல் Mouse Hover செய்யும்போது title தகவல் Tooltip ஆகத் தோன்றலாம்.
How to View HTML Source Code
Desktop Browser-இல் Page-இன் காலியான பகுதியில் Right-click செய்து View Page Source தேர்ந்தெடுக்கவும்.
பொதுவான Shortcuts:
- Windows/Linux:
Ctrl + U - macOS: Supported Browsers-இல்
Option + Command + U
குறிப்பிட்ட Element-ஐ ஆய்வு செய்ய Right-click → Inspect பயன்படுத்தவும்.
Note: View Page Source பொதுவாக Original HTML-ஐக் காட்டும். Inspect தற்போதைய DOM-ஐக் காட்டும்; JavaScript அதில் மாற்றங்களைச் செய்திருக்கலாம்.
Complete Practical Example
பல HTML Elements-ஐ இணைத்து ஒரு Web Page உருவாக்குவோம்.
<!DOCTYPE html>
<html>
<head>
<title>My HTML Practice</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>I am learning HTML with W3PrimeCode.</p>
<h2>About HTML</h2>
<p>HTML is used to structure web content.</p>
<hr>
<h2>Useful Link</h2>
<a href="https://www.example.com">
Visit Example Website
</a>
<h2>Sample Image</h2>
<img
src="https://www.w3.org/Icons/w3c_home"
alt="W3C Logo"
width="100"
>
<h2>Button Example</h2>
<button type="button">Click Me</button>
</body>
</html>Expected Output: Browser-இல் Headings, Paragraphs, Horizontal Line, Clickable Link, Image (Resource Load ஆனால்) மற்றும் Button தோன்றும்.
Common Beginner Mistakes
Mistake 1: Closing Tag எழுத மறப்பது
Incorrect:
<h1>Welcome
<p>Hello World</p>Correct:
<h1>Welcome</h1>
<p>Hello World</p>Mistake 2: Attribute Values-க்கு Quotes பயன்படுத்தாதது
HTML சில சூழல்களில் Quotes இல்லாத Values-ஐ ஏற்றுக்கொள்ளும். இருப்பினும் Consistency-க்காக Quotes பயன்படுத்துவது Recommended.
<a href="https://www.example.com">Visit Website</a>**Mistake 3: Image-க்கு alt வழங்காதது**
Informative Image-க்கு:
<img src="photo.jpg" alt="A mountain landscape">Mistake 4: Font Size மாற்றுவதற்காக மட்டும் Headings பயன்படுத்துவது
Headings Content Hierarchy-ஐக் குறிக்கின்றன. Appearance மாற்ற CSS பயன்படுத்தவும்.
Try It Yourself
basic-examples.html என்ற File உருவாக்குங்கள்.
<!DOCTYPE html>
<html>
<head>
<title>HTML Practice</title>
</head>
<body>
<h1>My First Website</h1>
<p>Write your introduction here.</p>
<h2>My Favorite Website</h2>
<a href="https://www.example.com">
Visit Website
</a>
</body>
</html>உங்கள் Tasks:
- Main Heading-ஐ மாற்றுங்கள்.
- இரண்டு புதிய Paragraphs சேர்க்கவும்.
- புதிய
<h2>Heading உருவாக்கவும். - விருப்பமான Website-க்கான Link சேர்க்கவும்.
<img>மூலம் Image சேர்க்கவும்.- ஒரு Button உருவாக்கவும்.
- File Save செய்து Browser-இல் Output பார்க்கவும்.