Chapter 210m

HTML Basic in Kannada

ಕನ್ನಡದಲ್ಲಿ HTML Basic Examples ಕಲಿಯಿರಿ. Headings, Paragraphs, Links, Images, Buttons ಮತ್ತು Attributes ಗಳ Practical Code Examples.

ಹಿಂದಿನ Chapter ನಲ್ಲಿ HTML File ರಚಿಸುವುದು, Save ಮಾಡುವುದು ಮತ್ತು Browser ನಲ್ಲಿ Open ಮಾಡುವುದನ್ನು ಕಲಿತಿದ್ದೀರಿ.

ಈಗ Practical Examples ಮೂಲಕ HTML ಕಲಿಯೋಣ!

ಈ Chapter ನಲ್ಲಿ Basic HTML Document, Headings, Paragraphs, Links, Images, Buttons ಮತ್ತು ಇತರ ಸಾಮಾನ್ಯ HTML Elements ಬಳಸುವುದನ್ನು ಕಲಿಯುತ್ತೀರಿ.

A Basic HTML Document

ಒಂದು ಸಾಮಾನ್ಯ HTML Page ನ Structure ಹೀಗಿರುತ್ತದೆ.

Example:

html
<!DOCTYPE html>
<html>
<head>
    <title>My First HTML Page</title>
</head>
<body>
    <h1>Welcome to W3PrimeCode</h1>
    <p>This is my first HTML page.</p>
</body>
</html>

Code Explanation

Codeವಿವರಣೆ
\<!DOCTYPE html>Document HTML5 ಬಳಸುತ್ತದೆ ಎಂದು ಘೋಷಿಸುತ್ತದೆ.
\<html>HTML Document ನ Root Element.
\<head>Document Metadata ಅನ್ನು ಹೊಂದಿರುತ್ತದೆ.
\<title>Browser Tab Title ಅನ್ನು ನಿರ್ಧರಿಸುತ್ತದೆ.
\<body>ಮುಖ್ಯ Visible Content ಅನ್ನು ಹೊಂದಿರುತ್ತದೆ.
\<h1>Top-level Heading ರಚಿಸುತ್ತದೆ.
\<p>Paragraph ರಚಿಸುತ್ತದೆ.

HTML Headings

HTML ನಲ್ಲಿ <h1> ರಿಂದ <h6> ವರೆಗೆ ಆರು Heading Levels ಇವೆ.

<h1> ಅತ್ಯುನ್ನತ Level ಮತ್ತು <h6> ಅತ್ಯಂತ ಕೆಳಮಟ್ಟದ Level ಅನ್ನು ಸೂಚಿಸುತ್ತದೆ.

Example:

html
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

Expected Output: Browser ಆರು Headings ಅನ್ನು ಅವುಗಳ Default Styles ಪ್ರಕಾರ ತೋರಿಸುತ್ತದೆ.

Important: ಕೇವಲ Font Size ಬದಲಾಯಿಸಲು Headings ಬಳಸಬೇಡಿ. Content Hierarchy ಪ್ರಕಾರ Heading Level ಆಯ್ಕೆಮಾಡಿ.

HTML Paragraphs

<p> Element ಬಳಸಿ Paragraph ರಚಿಸಬಹುದು.

Example:

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

Browser ಸಾಮಾನ್ಯವಾಗಿ Paragraphs ಅನ್ನು ಪ್ರತ್ಯೇಕ Blocks ಆಗಿ ತೋರಿಸುತ್ತದೆ.

HTML Links

HTML Links ಮೂಲಕ ಒಂದು Page ನಿಂದ ಮತ್ತೊಂದು Page ಅಥವಾ Resource ಗೆ ಹೋಗಬಹುದು.

Link ರಚಿಸಲು <a> Element ಬಳಸಲಾಗುತ್ತದೆ.

Syntax:

html
<a href="URL">Link Text</a>

Example:

html
<a href="https://www.example.com">
    Visit Example Website
</a>

ಇಲ್ಲಿ href Attribute Link Destination ಅನ್ನು ನಿರ್ಧರಿಸುತ್ತದೆ. Visit Example Website ಎನ್ನುವುದು Clickable Text ಆಗಿದೆ.

HTML Images

Web Page ನಲ್ಲಿ Image ಸೇರಿಸಲು <img> Element ಬಳಸಲಾಗುತ್ತದೆ.

Example:

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

Expected Output: Image Resource ಲಭ್ಯವಿದ್ದರೆ Browser W3C Logo ತೋರಿಸುತ್ತದೆ.

Attributeಕಾರ್ಯ
srcImage Location ಅನ್ನು ನಿರ್ಧರಿಸುತ್ತದೆ.
altImage ಗಾಗಿ Text Alternative ಒದಗಿಸುತ್ತದೆ.
widthImage Display Width ಅನ್ನು ನಿರ್ಧರಿಸುತ್ತದೆ.

alt Attribute Accessibility ಗೆ ಮುಖ್ಯವಾಗಿದೆ. Image ಕಾಣಿಸದಿದ್ದರೂ ಅದರ ವಿಷಯ ಅಥವಾ ಉದ್ದೇಶವನ್ನು ಅರ್ಥಮಾಡಿಕೊಳ್ಳಲು ಸಹಾಯ ಮಾಡುತ್ತದೆ.

<img> ಒಂದು Void Element. ಇದಕ್ಕೆ Closing Tag ಅಗತ್ಯವಿಲ್ಲ.

HTML Buttons

Button ರಚಿಸಲು <button> Element ಬಳಸಲಾಗುತ್ತದೆ.

Example:

html
<button type="button">Click Me</button>

Expected Output: Click Me ಎಂಬ Text ಹೊಂದಿರುವ Button ಕಾಣಿಸುತ್ತದೆ.

ಈ Button ಸ್ವತಃ ಯಾವುದೇ Custom Action ಮಾಡುವುದಿಲ್ಲ. ನಂತರ JavaScript ಬಳಸಿ Interactivity ಸೇರಿಸಬಹುದು.

HTML Line Breaks

<br> Element Text ಮಧ್ಯೆ Line Break ಸೇರಿಸುತ್ತದೆ.

Example:

html
<p>
    Hello World!<br>
    Welcome to HTML.
</p>

<br> ಒಂದು Void Element. Page Layout ನಲ್ಲಿ Spacing ರಚಿಸಲು ಪದೇಪದೇ <br> ಬಳಸುವ ಬದಲು CSS ಬಳಸಿ.

HTML Horizontal Rules

<hr> Element Content ನ ಎರಡು Sections ನಡುವೆ Thematic Break ಅನ್ನು ಸೂಚಿಸುತ್ತದೆ.

Example:

html
<h2>HTML Tutorial</h2>
<p>Learn HTML step by step.</p>

<hr>

<h2>CSS Tutorial</h2>
<p>Learn how to style web pages.</p>

Expected Output: Browser ಸಾಮಾನ್ಯವಾಗಿ ಎರಡು Sections ನಡುವೆ Horizontal Line ತೋರಿಸುತ್ತದೆ.

HTML Attributes

HTML Attributes ಒಂದು Element ಬಗ್ಗೆ ಹೆಚ್ಚುವರಿ ಮಾಹಿತಿ ಅಥವಾ Configuration ಒದಗಿಸುತ್ತವೆ.

Syntax:

html
<tagname attribute="value">Content</tagname>

Example:

html
<a href="https://www.example.com">Visit Website</a>

ಇಲ್ಲಿ href ಒಂದು Attribute ಆಗಿದೆ.

ಇನ್ನೊಂದು Example:

html
<p title="This is a tooltip">
    Move your mouse over this paragraph.
</p>

ಅನೇಕ Desktop Browsers ನಲ್ಲಿ Mouse Hover ಮಾಡಿದಾಗ title ಮಾಹಿತಿ Tooltip ಆಗಿ ಕಾಣಿಸಬಹುದು.

How to View HTML Source Code

Desktop Browser ನಲ್ಲಿ Page ನ ಖಾಲಿ ಜಾಗದಲ್ಲಿ Right-click ಮಾಡಿ View Page Source ಆಯ್ಕೆಮಾಡಿ.

ಸಾಮಾನ್ಯ Shortcuts:

  • Windows/Linux: Ctrl + U
  • macOS: Supported Browsers ನಲ್ಲಿ Option + Command + U

ನಿರ್ದಿಷ್ಟ Element ಪರಿಶೀಲಿಸಲು Right-click → Inspect ಬಳಸಿ.

Note: View Page Source ಸಾಮಾನ್ಯವಾಗಿ Original HTML ತೋರಿಸುತ್ತದೆ. Inspect ಪ್ರಸ್ತುತ DOM ತೋರಿಸುತ್ತದೆ; JavaScript ಅದರಲ್ಲಿ ಬದಲಾವಣೆಗಳನ್ನು ಮಾಡಿರಬಹುದು.

Complete Practical Example

ವಿವಿಧ HTML Elements ಸೇರಿಸಿ ಒಂದು Web Page ರಚಿಸೋಣ.

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

    <h1>Welcome to My Website</h1>

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

    <h2>About HTML</h2>

    <p>HTML is used to structure web content.</p>

    <hr>

    <h2>Useful Link</h2>

    <a href="https://www.example.com">
        Visit Example Website
    </a>

    <h2>Sample Image</h2>

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

    <h2>Button Example</h2>

    <button type="button">Click Me</button>

</body>
</html>

Expected Output: Browser ನಲ್ಲಿ Headings, Paragraphs, Horizontal Line, Clickable Link, Image (Resource Load ಆದರೆ) ಮತ್ತು Button ಕಾಣಿಸುತ್ತವೆ.

Common Beginner Mistakes

Mistake 1: Closing Tag ಮರೆಯುವುದು

Incorrect:

html
<h1>Welcome
<p>Hello World</p>

Correct:

html
<h1>Welcome</h1>
<p>Hello World</p>

Mistake 2: Attribute Values ಗೆ Quotes ಬಳಸದಿರುವುದು

HTML ಕೆಲವು ಸಂದರ್ಭಗಳಲ್ಲಿ Quotes ಇಲ್ಲದ Values ಅನ್ನು ಸ್ವೀಕರಿಸುತ್ತದೆ. ಆದರೆ Consistency ಗಾಗಿ Quotes ಬಳಸುವುದು Recommended.

html
<a href="https://www.example.com">Visit Website</a>

**Mistake 3: Image ಗೆ alt ನೀಡದಿರುವುದು**

Informative Image ಗಾಗಿ:

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

Mistake 4: ಕೇವಲ Font Size ಬದಲಾಯಿಸಲು Headings ಬಳಸುವುದು

Headings Content Hierarchy ಅನ್ನು ಸೂಚಿಸುತ್ತವೆ. Appearance ಬದಲಾಯಿಸಲು CSS ಬಳಸಿ.

Try It Yourself

basic-examples.html ಎಂಬ File ರಚಿಸಿ.

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

    <h1>My First Website</h1>

    <p>Write your introduction here.</p>

    <h2>My Favorite Website</h2>

    <a href="https://www.example.com">
        Visit Website
    </a>

</body>
</html>

ನಿಮ್ಮ Tasks:

  1. Main Heading ಬದಲಾಯಿಸಿ.
  2. ಎರಡು ಹೊಸ Paragraphs ಸೇರಿಸಿ.
  3. ಹೊಸ <h2> Heading ರಚಿಸಿ.
  4. ನಿಮ್ಮ ಇಷ್ಟದ Website Link ಸೇರಿಸಿ.
  5. <img> ಬಳಸಿ Image ಸೇರಿಸಿ.
  6. ಒಂದು Button ರಚಿಸಿ.
  7. File Save ಮಾಡಿ Browser ನಲ್ಲಿ Output ನೋಡಿ.