Tech Urdu

HTML Elements | Nested HTML Elements | Empty HTML Elements

HTML Elements, Ek HTML ka element jisko ansar kaha jata hai, usko start tag se shuru kiya jata hai, phir kuch mawaad likha jata hai ya photos aur videos us ke andar lagae jate hain phir usko end tag se khatam kiya jata hai.

<tagname>kuch mawad</tagname>

Neeche hum kuch misaalen de rahe hain:-

<h1>My First Heading</h1>
<p>My first paragraph.</p>
html elements

Nested HTML Ke Elements:-

HTML ansar ko doosre ansar ke andar istaimlaal kiya ja sakta hai (Is ki maanay ye hai ke ek ansar ke andar doosra ansar mushtamil ho sakta hai).

Sab HTML ke documents ko Nested Elements ke tor par istaimaal kiya jata hai.

Neeche diye gae misaal 4 HTML anasir par mushkil hai (<html><body><h1> and <p>):

Example

<!DOCTYPE html>
<html>
<body><h1>My First Heading</h1>
<p>My first paragraph.</p></body>
</html>

Oopar di gae misaal ko neeche samjhaya gay hai:-

Ye jo <html> ansar bunyadi ansar kehlata hai aur ye poore HTML document ko zahir karta hai.

Is main ek Shuru Tag <html> aur ek Khatam Tag </html> hai.

Uske baad in <html> tags yar ansar ke andar wahan pe ek <body> ansar hai:

<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>

Ye <body> ansar document ki body zahir karta hai.

Iska ek Shuru Tag <body> aur Aakhir Tag </body> hota hai.

Phir, <body> ansar ke andar 2 aur ansar hain: <h1> aur <p>:

 

<h1>My First Heading</h1>
<p>My first paragraph.</p>

 

Ye <h1> ansar headings ko zahir karta hai.

Isko ek Shuru Tag <h1> aur ek Aakhir Tag </h1>hota hai.

<h1>My First Heading</h1>

 

Ye <p> ansar paragraph ko zahir karta hai.

Iska ek Shuru Tag <p> aur ek Akhir Tag </p> hota hai.

<p>My first paragraph.</p>

Kabhi bhi Akhir Tag ko na bhoolna

Kuch HTML ansar sahi zahir honge, agar aap Akhir Tag band karna bhool jaate hain:

Example

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

However, never rely on this! Unexpected results and errors may occur if you forget the end tag!


Empty HTML Elements

HTML elements with no content are called empty elements.

The <br> tag defines a line break, and is an empty element without a closing tag:

Example

<p>This is a <br> paragraph with a line break.</p>

Bahar haal, is par kabhi bharosa na karen, agar aap Akhir Tag bhool jate hain, to ghair mutawaqia nataaij mil sakte hain, aur ghaltiyan bhi ho sakti hain!


Khaali HTML Ansar

Aise HTML ansar jin ke andar koi mawaad na ho usko khaali HTML Ansar kaha jata hai.

Ye <br> tag line break ko zahir karti hai, aur ye khaali ansar hota hai, aur isko band nahi kiya jata matlab ke iski Aakhir Tag nahi hoti:

Example

<p>Ye hai ek <br> paragraph line break ke saath.</p>

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!