Chapter 310m

HTML Elements in Telugu

తెలుగులో 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 ఉండదు. కొన్ని 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:

text
<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 అందుబాటులో ఉంటే) కనిపిస్తాయి.

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 చూడండి.