Chapter 310m

HTML Elements in Tamil

தமிழில் HTML Elements கற்றுக்கொள்ளுங்கள். Start Tag, End Tag, Nested Elements, Void Elements மற்றும் Correct HTML Structure-ஐ Examples மூலம் புரிந்துகொள்ளுங்கள்.

முந்தைய Chapter-இல் Basic HTML Examples மூலம் Web Page உருவாக்கக் கற்றுக்கொண்டீர்கள்.

இப்போது HTML Elements எவ்வாறு செயல்படுகின்றன என்பதைப் புரிந்துகொள்வோம்.

HTML Elements என்பது Web Page-இன் Building Blocks ஆகும். அவை Content-இன் Structure மற்றும் Meaning-ஐ வரையறுக்கின்றன.

இந்த Chapter-இல் Start Tag, End Tag, Element Content, Nested Elements, Void Elements மற்றும் Correct Nesting பற்றி அறிந்துகொள்வீர்கள்.

What is an HTML Element?

பொதுவாக HTML Element-இல் Start Tag, Content மற்றும் End Tag இருக்கும்.

Syntax:

html
<tagname>Content goes here...</tagname>

Example:

html
<h1>Welcome to HTML</h1>
Partவிளக்கம்
\<h1>Start Tag — Element தொடங்குவதைக் குறிக்கிறது.
Welcome to HTMLElement Content — உள்ளே உள்ள Text.
\</h1>End Tag — Element முடிவதைக் குறிக்கிறது.

HTML Tag மற்றும் HTML Element இரண்டும் ஒரே பொருளைக் குறிக்கவில்லை. Tags என்பது Element-ஐ வரையறுக்கும் Syntax-இன் பகுதிகள்.

Start Tags and End Tags

பெரும்பாலான HTML Elements-இல் Start Tag மற்றும் End Tag இரண்டும் இருக்கும்.

End Tag-இல் Tag Name-க்கு முன் / இருக்கும்.

html
<p>This is a paragraph.</p>

இங்கு <p> என்பது Start Tag; </p> என்பது End Tag.

Another Example:

html
<h2>About Me</h2>
<p>I am learning HTML.</p>

அனைத்து HTML Elements-க்கும் End Tag இருப்பதில்லை. சில Elements, Void Elements ஆகும்.

Nested HTML Elements

ஒரு HTML Element-க்குள் மற்றொரு Element இருந்தால், அது Nested Element எனப்படும்.

Example:

html
<p>
    I am learning <strong>HTML</strong> today.
</p>

இங்கு <p> என்பது Parent Element; <strong> என்பது Child Element.

<strong> அதன் Content-க்கு அதிக முக்கியத்துவம் அளிக்கிறது. Browser பொதுவாக அதை Bold-ஆகக் காட்டும்.

Another Example:

html
<div>
    <h2>My Profile</h2>
    <p>Welcome to my website.</p>
</div>

இங்கு <h2> மற்றும் <p> இரண்டும் <div>-க்குள் Nested ஆக உள்ளன.

Nested Structure of an HTML Document

html
<!DOCTYPE html>
<html>
<head>
    <title>HTML Elements</title>
</head>
<body>
    <h1>My First Heading</h1>
    <p>My first paragraph.</p>
</body>
</html>

Structure Explained:

  • <html> என்பது Root Element.
  • <head> மற்றும் <body> ஆகியவை <html>-இன் Child Elements.
  • <title> என்பது <head>-க்குள் உள்ளது.
  • <h1> மற்றும் <p> ஆகியவை <body>-க்குள் உள்ளன.

Important: <!DOCTYPE html> என்பது Declaration; HTML Element அல்ல.

Never Forget the End Tag

சில HTML End Tags-ஐ குறிப்பிட்ட விதிகளின்படி விடலாம். இருப்பினும் Beginners தெளிவான Closing Tags எழுதுவது நல்ல பழக்கம்.

Recommended:

html
<p>This is my first paragraph.</p>
<p>This is my second paragraph.</p>

சில சூழல்களில் </p>-ஐ விடுவது செல்லுபடியாக இருந்தாலும், எல்லா End Tags-உம் Optional அல்ல.

Void Elements

Child Content மற்றும் End Tag இல்லாத HTML Elements, Void Elements எனப்படும்.

Elementபணி
\<br>Line Break சேர்க்கிறது.
\<hr>Thematic Break-ஐக் குறிக்கிறது.
\<img>Image Embed செய்கிறது.
\<input>Input Control உருவாக்குகிறது.
\<meta>Document Metadata வழங்குகிறது.
\<link>External Resource இணைக்கிறது.

Example:

html
<p>Hello<br>World!</p>

Image Example:

html
<img src="photo.jpg" alt="A landscape photograph">

<img>-க்கு </img> தேவையில்லை.

HTML Syntax-இல் <br /> என்று எழுதலாம். ஆனால் Trailing Slash கட்டாயமில்லை; அது Closing Tag-ஐ உருவாக்காது.

HTML Tag Names and Case

Standard HTML Syntax-இல் Tag Names Case-insensitive ஆகும்.

html
<P>This is a paragraph.</P>

மற்றும்

html
<p>This is a paragraph.</p>

இரண்டும் Paragraph Element-ஆக அடையாளம் காணப்படும்.

Recommended: HTML Tag Names-ஐ Lowercase-இல் எழுதுங்கள்.

Correct Nesting

Nested Elements சரியான வரிசையில் Close செய்யப்பட வேண்டும்.

Incorrect:

html
<p>This is <strong>important.</p></strong>

Correct:

html
<p>This is <strong>important.</strong></p>

உள்ளே இருக்கும் Element-ஐ முதலில் Close செய்து, பின்னர் Parent Element-ஐ Close செய்யுங்கள்.

Block and Inline Elements: First Look

சில Elements Browser-இல் பொதுவாகத் தனித்தனி Blocks-ஆகக் காட்டப்படும்:

html
<h2>My Heading</h2>
<p>My paragraph.</p>

ஆனால் <strong> பொதுவாக அதே Text Line-இல் தோன்றும்:

html
<p>Learn <strong>HTML</strong> with W3PrimeCode.</p>

CSS மூலம் Display Behavior-ஐ மாற்றலாம்.

Complete Practical Example

html
<!DOCTYPE html>
<html>
<head>
    <title>Understanding HTML Elements</title>
</head>
<body>

    <div>
        <h1>Welcome to My Website</h1>

        <p>
            I am learning <strong>HTML</strong>
            with W3PrimeCode.
        </p>

        <hr>

        <h2>My Introduction</h2>

        <p>
            My name is Alex.<br>
            I want to become a Web Developer.
        </p>

        <img
            src="https://www.w3.org/Icons/w3c_home"
            alt="W3C Logo"
            width="100"
        >
    </div>

</body>
</html>

Expected Output: Browser-இல் Main Heading, முக்கியமான Word கொண்ட Paragraph, Thematic Break, இரண்டாவது Heading, Line Break கொண்ட Paragraph மற்றும் Image (Resource கிடைத்தால்) தோன்றும்.

இந்த Example-இல் Nested Elements மற்றும் Void Elements இரண்டும் பயன்படுத்தப்பட்டுள்ளன.

Common Beginner Mistakes

Mistake 1: End Tag எழுத மறப்பது

Incorrect:

html
<h1>Welcome to HTML

Correct:

html
<h1>Welcome to HTML</h1>

Mistake 2: Incorrect Nesting

Incorrect:

html
<p>Hello <strong>World</p></strong>

Correct:

html
<p>Hello <strong>World</strong></p>

Mistake 3: Void Element-க்கு End Tag சேர்ப்பது

Incorrect:

html
<br></br>

Correct:

html
<br>

Try It Yourself

html-elements.html என்ற File உருவாக்குங்கள்.

html
<!DOCTYPE html>
<html>
<head>
    <title>HTML Elements Practice</title>
</head>
<body>

    <h1>My Profile</h1>

    <p>
        My name is <strong>Your Name</strong>.
    </p>

    <hr>

    <p>
        I am learning HTML.<br>
        This is my practice page.
    </p>

</body>
</html>

உங்கள் Tasks:

  1. Your Name-ஐ மாற்றுங்கள்.
  2. ஒரு <h2> Heading சேர்க்கவும்.
  3. புதிய Paragraph உருவாக்கவும்.
  4. ஒரு Heading மற்றும் Paragraph-ஐ <div>-க்குள் வைக்கவும்.
  5. பொருத்தமான alt Text உடன் Image சேர்க்கவும்.
  6. எல்லா Nested Elements-உம் சரியாக Close செய்யப்பட்டுள்ளனவா என்று சரிபார்க்கவும்.
  7. File Save செய்து Browser-இல் Output பார்க்கவும்.