Chapter 310m

HTML Elements in Kannada

ಕನ್ನಡದಲ್ಲಿ 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:

text
<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:

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

Expected Output:

Hello World!

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 ನೋಡಿ.