HTML Opening & Closing Tags
HTML Opening మరియు Closing Tags
HTMLలో ప్రతి element సాధారణంగా opening tag మరియు closing tag కలయికతో తయారవుతుంది. Opening tag element ఎక్కడ ప్రారంభమవుతుందో చూపిస్తుంది. Closing tag element ఎక్కడ ముగుస్తుందో చూపిస్తుంది.
ఉదాహరణకు, heading కోసం <h1> opening tag మరియు </h1> closing tag ఉపయోగిస్తారు. వీటి మధ్యలో కనిపించాల్సిన text ఉంచుతారు.
సాధారణ HTML నిర్మాణం ఇలా ఉంటుంది: opening tag, content, closing tag. Closing tagలో opening tag కంటే ముందు forward slash (/) ఉంటుంది.
Opening Tag
Opening tagలో element పేరు angle brackets మధ్య ఉంటుంది. ఉదాహరణకు <p> ఒక paragraph ప్రారంభాన్ని సూచిస్తుంది.
Closing Tag
Closing tagలో element పేరుకు ముందు slash ఉంటుంది. ఉదాహరణకు </p> paragraph ముగింపును సూచిస్తుంది.
కొన్ని HTML elementsకు closing tag అవసరం ఉండదు. అయితే ఈ పాఠంలో మనం closing tag ఉన్న సాధారణ elementsపై దృష్టి పెడతాం.
Simple Explanation
ఒక గది ప్రారంభం మరియు ముగింపు గోడల మధ్య ఉన్నట్లే, HTML element కూడా opening tag మరియు closing tag మధ్య ఉంటుంది.
ఉదాహరణ: <p>Hello</p> లో <p> ప్రారంభ tag, Hello content, </p> ముగింపు tag.
Real-Life Example
ఒక పుస్తకంలోని chapterకు ప్రారంభ శీర్షిక మరియు ముగింపు భాగం ఉన్నట్లే HTML elementకు కూడా ప్రారంభం మరియు ముగింపు ఉంటాయి. <h1> tag chapter headingను ప్రారంభిస్తే, </h1> tag ఆ headingను ముగిస్తుంది.
Code Examples
Heading మరియు Paragraph Tags
<h1>Hello HTML</h1>
<p>Welcome to HTML.</p>
ఇక్కడ <h1> మరియు </h1> మధ్య ఉన్న text పెద్ద headingగా కనిపిస్తుంది. అలాగే <p> మరియు </p> మధ్య ఉన్న text paragraphగా కనిపిస్తుంది.
The browser displays Hello HTML as a large heading and Welcome to HTML as a paragraph.
Complete HTML Document
<!DOCTYPE html>
<html lang="te">
<head>
<title>My HTML Page</title>
</head>
<body>
<h1>My First Page</h1>
<p>HTML is easy to learn.</p>
</body>
</html>
ఈ ఉదాహరణలో document కోసం opening మరియు closing tags జతలుగా ఉన్నాయి. <html> మరియు </html> మొత్తం documentను చుట్టి ఉంచుతాయి. <head> మరియు </head> మధ్య page సమాచారం ఉంటుంది. <body> మరియు </body> మధ్య browserలో కనిపించే content ఉంటుంది.
The browser displays My First Page as a heading and HTML is easy to learn. as a paragraph.
Line-by-Line Explanation
ఈ declaration document HTML5 document అని browserకు తెలియజేస్తుంది.
ఇది HTML document ప్రారంభ tag. lang attribute document భాషను సూచిస్తుంది.
ఇది documentలోని head భాగాన్ని ప్రారంభిస్తుంది.
<title> మరియు </title> మధ్య ఉన్న text browser tabలో కనిపిస్తుంది.
ఇది head భాగాన్ని ముగించే closing tag.
ఇది browserలో కనిపించే page contentను ప్రారంభిస్తుంది.
ఈ జత tags మధ్య ఉన్న text ప్రధాన headingగా కనిపిస్తుంది.
ఈ జత tags మధ్య ఉన్న text paragraphగా చూపబడుతుంది.
ఇది body భాగాన్ని ముగించే closing tag.
ఇది మొత్తం HTML documentను ముగించే closing tag.
Try It
Try this HTML code:
<!DOCTYPE html>
<html lang="te">
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Hello HTML</h1>
<p>Learn HTML</p>
</body>
</html>
Practice
Practice: ప్రస్తుతం ఉన్న heading textను మీకు నచ్చిన పేరుగా మార్చండి. paragraphలో HTML నేర్చుకోవడం గురించి ఒక వాక్యం రాయండి.
Hint: <h1> మరియు </h1> మధ్య heading textను మార్చండి. <p> మరియు </p> మధ్య paragraph textను మార్చండి.
Common Mistakes
ప్రతి సాధారణ elementకు సరైన closing tagను జోడించండి: <p>Hello</p>.
Closing tagలో element పేరుకు ముందు slash ఉండాలి: <p>Hello</p>.
చివరిగా ప్రారంభించిన elementను ముందుగా close చేయాలి. ప్రతి opening tagకు సరిపోయే closing tag ఉందో తనిఖీ చేయండి.
Opening మరియు closing tagsలో ఒకే element పేరు ఉండాలి: <h1>Title</h1>.
Interview Questions
HTML opening tag అంటే ఏమిటి?
Answer: Opening tag ఒక HTML element ఎక్కడ ప్రారంభమవుతుందో సూచిస్తుంది. ఉదాహరణకు <p> paragraph ప్రారంభాన్ని సూచిస్తుంది.
HTML closing tagను ఎలా గుర్తించవచ్చు?
Answer: Closing tagలో element పేరుకు ముందు forward slash ఉంటుంది. ఉదాహరణకు paragraph closing tag </p>.
Opening tag మరియు closing tag మధ్య ఉన్న textను ఏమంటారు?
Answer: Opening tag మరియు closing tag మధ్య ఉన్న భాగాన్ని element content అంటారు. ఉదాహరణకు <h1>Hello</h1>లో Hello content.
Exam Questions
సరైన HTML paragraph syntaxను ఎంచుకోండి.
Answer:
సరైన syntax: <p>This is a paragraph.</p>.
HTML closing tagలో తప్పనిసరిగా ఉండే గుర్తు ఏది?
Answer:
Closing tagలో element పేరుకు ముందు forward slash (/) ఉంటుంది.
ఈ syntaxలో తప్పును గుర్తించండి: <h1>Welcome<p>.
Answer:
ఇక్కడ <h1>కు సరైన closing tag లేదు మరియు <p> అనవసరంగా ఉపయోగించబడింది. సరైన syntax: <h1>Welcome</h1>.
Quick Revision
- HTML element సాధారణంగా opening tag, content, closing tagతో నిర్మితమవుతుంది.
- Opening tagలో element పేరు angle brackets మధ్య ఉంటుంది.
- Closing tagలో element పేరుకు ముందు forward slash ఉంటుంది.
- ఉదాహరణ: <p>Text</p>.
- Opening మరియు closing tagsలో element పేరు ఒకే విధంగా ఉండాలి.
- Tagsను సరైన క్రమంలో close చేయాలి.
