HTML Basic in Telugu
తెలుగులో 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:
<!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:
<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:
<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:
<a href="URL">Link Text</a>Example:
<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:
<img
src="https://www.w3.org/Icons/w3c_home"
alt="W3C Logo"
width="100"
>Expected Output: Image Resource అందుబాటులో ఉంటే Browser W3C Logo చూపిస్తుంది.
| Attribute | పని |
|---|---|
| src | Image Location ను నిర్వచిస్తుంది. |
| alt | Image కోసం Text Alternative అందిస్తుంది. |
| width | Image Display Width ను నిర్ణయిస్తుంది. |
alt Attribute Accessibility కోసం ముఖ్యమైనది. Image కనిపించకపోయినా దాని Content లేదా ఉద్దేశాన్ని అర్థం చేసుకోవడానికి సహాయపడుతుంది.
<img> ఒక Void Element. దీనికి Closing Tag అవసరం లేదు.
HTML Buttons
Button రూపొందించడానికి <button> Element ఉపయోగిస్తారు.
Example:
<button type="button">Click Me</button>ఈ Button స్వయంగా ఎలాంటి Custom Action చేయదు. తరువాత JavaScript ద్వారా Interactivity జోడించవచ్చు.
HTML Line Breaks
<br> Element Text మధ్య Line Break జోడిస్తుంది.
Example:
<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:
<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:
<tagname attribute="value">Content</tagname>Example:
<a href="https://www.example.com">Visit Website</a>ఇక్కడ href ఒక Attribute.
మరొక Example:
<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 రూపొందిద్దాం.
<!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:
<h1>Welcome
<p>Hello World</p>Correct:
<h1>Welcome</h1>
<p>Hello World</p>Mistake 2: Attribute Values కు Quotes ఉపయోగించకపోవడం
HTML కొన్ని సందర్భాల్లో Quotes లేకుండా Values అంగీకరిస్తుంది. అయినప్పటికీ Consistency కోసం Quotes ఉపయోగించడం Recommended.
<a href="https://www.example.com">Visit Website</a>**Mistake 3: Image కు alt ఇవ్వకపోవడం**
Informative Image కోసం:
<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 రూపొందించండి.
<!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:
- Main Heading మార్చండి.
- రెండు కొత్త Paragraphs జోడించండి.
- కొత్త
<h2>Heading రూపొందించండి. - మీకు నచ్చిన Website Link జోడించండి.
<img>ద్వారా Image జోడించండి.- ఒక Button రూపొందించండి.
- File Save చేసి Browser లో Output చూడండి.