3: Headings and Paragraphs

കഴിഞ്ഞ അധ്യായത്തിൽ ഒരു HTML5 document-ന്റെ അടിസ്ഥാന ഘടന പഠിച്ചു. ഇനി ആ document-ന്റെ -യിൽ യഥാർത്ഥ webpage content എങ്ങനെ ക്രമീകരിക്കാമെന്ന് പഠിക്കാം. ഒരു webpage-ൽ വിവരങ്ങൾ വ്യക്തമായി അവതരിപ്പിക്കാൻ headings-ഉം paragraphs-ഉം വളരെ പ്രധാനമാണ്.

Headings എന്താണ്?

ഒരു webpage-ലെ വിവിധ ഭാഗങ്ങൾക്ക് തലക്കെട്ട് നൽകാൻ HTML-ൽ headings ഉപയോഗിക്കുന്നു. HTML-ൽ <h1> മുതൽ <h6> വരെ ആറ് heading levels ഉണ്ട്.

<h1>Main Heading</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>

<h1> ആണ് ഏറ്റവും പ്രധാനപ്പെട്ട heading level. <h2> അതിന് താഴെയുള്ള ഒരു section-നെയും <h3> അതിന്റെ subsection-നെയും സൂചിപ്പിക്കാം. ഇങ്ങനെ <h6> വരെ heading hierarchy തുടരുന്നു.

ആറ് Heading Levels

Elementഉപയോഗം
<h1>Page-ന്റെ പ്രധാന heading
<h2>പ്രധാന section-ന്റെ heading
<h3>ഒരു <h2> section-ന്റെ subsection
<h4>ഒരു <h3> section-ന്റെ subsection
<h5>ഒരു <h4> section-ന്റെ subsection
<h6>Heading hierarchy-യിലെ ഏറ്റവും താഴത്തെ level

ഈ heading levels വലുപ്പം മാത്രം സൂചിപ്പിക്കുന്നവയല്ല. പ്രധാനമായും webpage-ന്റെ content hierarchy വ്യക്തമാക്കാനാണ് അവ ഉപയോഗിക്കുന്നത്. CSS പഠിക്കുമ്പോൾ heading-ന്റെ വലുപ്പവും രൂപവും മാറ്റാൻ കഴിയും.

ഒരു Heading Hierarchy

ഒരു പുസ്തകത്തിൽ chapter, section, subsection എന്നിങ്ങനെ ഉള്ളതുപോലെ webpage-ലും headings ഉപയോഗിച്ച് content ക്രമീകരിക്കാം.

<h1>HTML Course</h1>

<h2>Introduction</h2>
<p>HTML is used to structure webpages.</p>

<h2>HTML Elements</h2>

<h3>Headings</h3>
<p>Headings organize the content of a webpage.</p>

<h3>Paragraphs</h3>
<p>Paragraphs contain blocks of text.</p>

ഇവിടെ <h1>' മുഴുവൻ page-ന്റെ പ്രധാന heading ആണ്. അതിന് കീഴിൽ രണ്ട് <h2> sections ഉണ്ട്. രണ്ടാമത്തെ <h2>-ന്റെ കീഴിൽ രണ്ട് <h3> subsections ഉണ്ട്. ഇതാണ് heading hierarchy.

<h1> എങ്ങനെ ഉപയോഗിക്കണം?

<h1> സാധാരണയായി page-ന്റെ പ്രധാന വിഷയം വ്യക്തമാക്കാനാണ് ഉപയോഗിക്കുന്നത്. ഒരു webpage-ന്റെ main topic വ്യക്തമാക്കുന്ന heading ആയി ഇത് ഉപയോഗിക്കാം.

<h1>Learning HTML</h1>
<p>HTML helps us create structured webpages.</p>

ഒരു page-ൽ പല headings ഉണ്ടാകാം. എന്നാൽ heading hierarchy വ്യക്തമായി നിലനിർത്തണം. ഒരു section-ന്റെ കീഴിലുള്ള content-ന് അനുയോജ്യമായ heading level ഉപയോഗിക്കുന്നത് നല്ല രീതിയാണ്.

Headings ക്രമത്തിൽ ഉപയോഗിക്കുക

Heading levels വെറും text വലുതാക്കാൻ ഉപയോഗിക്കരുത്. ഉദാഹരണത്തിന് <h2>-ന് ശേഷം നേരിട്ട് <h5> ഉപയോഗിക്കുന്നത് content hierarchy വ്യക്തമല്ലാതാക്കാം. സാധാരണയായി content structure അനുസരിച്ച് heading levels ക്രമത്തിൽ ഉപയോഗിക്കുന്നതാണ് നല്ലത്.

<h1>My Website</h1>

<h2>About Me</h2>
<p>This section contains information about me.</p>

<h2>My Skills</h2>
<h3>Programming</h3>
<p>I am learning HTML and Python.</p>

<h3>Languages</h3>
<p>I am learning different languages.</p>

ഇവിടെ <h1> page-ന്റെ main heading ആണ്. <h2> elements പ്രധാന sections ആണ്. അവയുടെ കീഴിലുള്ള <h3> elements subsections ആണ്.

Paragraphs എന്താണ്?

ഒരു webpage-ൽ സാധാരണമായ text content എഴുതാൻ <p> element ഉപയോഗിക്കുന്നു. Paragraph എന്നത് ഒരു ആശയം അല്ലെങ്കിൽ വിവരത്തിന്റെ ഒരു ഭാഗം ക്രമമായി അവതരിപ്പിക്കാൻ സഹായിക്കുന്ന text block ആണ്.

<p>HTML is used to create the structure of webpages.</p>
<p>CSS is used to style webpages.</p>

ഇവിടെ രണ്ട് വ്യത്യസ്ത paragraphs ഉണ്ട്. ഓരോ paragraph-നും സ്വന്തം <p> opening tag-ഉം </p> closing tag-ഉം ഉണ്ട്.

ഒരു Paragraph-ൽ കൂടുതൽ Text

ഒരു paragraph-ന്റെ ഉള്ളിൽ ആവശ്യത്തിന് text എഴുതാം. Browser window-ന്റെ വീതി അനുസരിച്ച് browser text സ്വയം അടുത്ത വരിയിലേക്ക് മാറ്റും.

<p>HTML is a markup language used to structure content on the web. A webpage can contain headings, paragraphs, links, images, lists, tables and forms.</p>

Code-ൽ paragraph ഒരു വരിയിലായാലും പല വരികളിലായാലും browser-ന്റെ കാഴ്ചയിൽ അത് ഒരേ paragraph element തന്നെയാണ്.

HTML Code-ലെ Line Break vs Webpage-ലെ Line Break

HTML code-ൽ Enter അമർത്തി പുതിയ line തുടങ്ങുന്നത് മാത്രം browser-ൽ പുതിയ line സൃഷ്ടിക്കുമെന്ന് കരുതരുത്. ഒരു paragraph-ന്റെ ഉള്ളിൽ പ്രത്യേകമായി line break ആവശ്യമായപ്പോൾ <br> ഉപയോഗിക്കാം.

<p>First line<br>Second line<br>Third line</p>

<br> ഒരു line break നൽകുന്നു. ഇതിന് സാധാരണയായി closing tag ഇല്ല. എന്നാൽ സാധാരണ paragraphs വേർതിരിക്കാൻ തുടർച്ചയായി <br> ഉപയോഗിക്കുന്നതിന് പകരം ഓരോ ആശയത്തിനും പ്രത്യേകം <p> ഉപയോഗിക്കുന്നതാണ് നല്ലത്.

<hr> — Horizontal Rule

Content-ന്റെ രണ്ട് പ്രധാന ഭാഗങ്ങൾക്കിടയിൽ thematic break കാണിക്കാൻ <hr> element ഉപയോഗിക്കാം. Browser സാധാരണയായി ഇത് ഒരു horizontal line ആയി കാണിക്കും.

<h2>About HTML</h2>
<p>HTML structures webpage content.</p>

<hr>

<h2>About CSS</h2>
<p>CSS controls the presentation of webpage content.</p>

<hr> ഒരു line വരയ്ക്കാനുള്ള styling tool മാത്രമായി കാണേണ്ടതില്ല. Content-ന്റെ രണ്ട് വ്യത്യസ്ത thematic sections തമ്മിലുള്ള വിഭജനം വ്യക്തമാക്കാനാണ് ഇത് ഉപയോഗിക്കുന്നത്.

Headings + Paragraphs ഉപയോഗിച്ച് ഒരു Article

ഇപ്പോൾ headings-ഉം paragraphs-ഉം ചേർത്ത് ഒരു ചെറിയ article തയ്യാറാക്കാം.

<h1>Introduction to Web Development</h1>
<p>Web development is the process of creating websites and web applications.</p>

<h2>HTML</h2>
<p>HTML provides the structure and content of a webpage.</p>

<h2>CSS</h2>
<p>CSS is used to control the presentation and layout of a webpage.</p>

<h2>JavaScript</h2>
<p>JavaScript can add interaction and dynamic behavior to webpages.</p>

ഇവിടെ ഒരു main heading-നും അതിന് കീഴിൽ മൂന്ന് sections-ഉം ഉണ്ട്. ഓരോ section-നും ഒരു heading-ഉം paragraph-ഉം നൽകിയിരിക്കുന്നു. ഇതുപോലുള്ള structure ആണ് പിന്നീട് വലിയ webpages നിർമ്മിക്കുമ്പോൾ ഉപയോഗിക്കുന്നത്.

Heading വലുപ്പം മാറ്റാൻ Heading Level ഉപയോഗിക്കരുത്

ഒരു heading ചെറുതായി കാണിക്കണം എന്ന കാരണത്താൽ <h4> ഉപയോഗിക്കുകയും വലിയതായി കാണിക്കണം എന്ന കാരണത്താൽ <h1> ഉപയോഗിക്കുകയും ചെയ്യരുത്. Heading level content-ന്റെ പ്രാധാന്യവും hierarchy-യും സൂചിപ്പിക്കാനാണ്. Text-ന്റെ appearance പിന്നീട് CSS ഉപയോഗിച്ച് നിയന്ത്രിക്കാം.

<h1>My Website</h1>
<h2>About Me</h2>
<p>I am learning web development.</p>

ഇവിടെ heading levels content structure അനുസരിച്ചാണ് ഉപയോഗിച്ചിരിക്കുന്നത്. പിന്നീട് CSS പഠിക്കുമ്പോൾ ഈ headings-ന്റെ വലുപ്പവും നിറവും font-ഉം മാറ്റാം.

Headings-നും Paragraphs-നും ഇടയിലെ ബന്ധം

ഒരു heading സാധാരണയായി അതിന് ശേഷം വരുന്ന content-ന്റെ വിഷയം വ്യക്തമാക്കുന്നു. അതിന് കീഴിൽ ഒന്നോ അതിലധികമോ paragraphs ഉണ്ടായിരിക്കാം. ഇങ്ങനെ headings ഉപയോഗിക്കുന്നത് webpage വായിക്കുന്ന വ്യക്തിക്കും browser-നെ സഹായിക്കുന്ന technology-കൾക്കും content structure മനസ്സിലാക്കാൻ സഹായിക്കുന്നു.

<h1>Healthy Food</h1>
<p>Healthy food provides the nutrients our body needs.</p>

<h2>Fruits</h2>
<p>Fruits contain vitamins, minerals and other nutrients.</p>

<h2>Vegetables</h2>
<p>Vegetables are an important part of a balanced diet.</p>

സാധാരണ തുടക്കക്കാരുടെ തെറ്റുകൾ

  • Heading-ന്റെ വലുപ്പം മാത്രം നോക്കി <h1> മുതൽ <h6> വരെ തിരഞ്ഞെടുക്കുന്നു
  • Heading levels അനാവശ്യമായി skip ചെയ്യുന്നു
  • ഒരു paragraph-ന്റെ text മുഴുവൻ <h1> അല്ലെങ്കിൽ മറ്റൊരു heading element-ൽ എഴുതുന്നു
  • വ്യത്യസ്ത paragraphs വേർതിരിക്കാൻ <br> പലതവണ ഉപയോഗിക്കുന്നു
  • HTML code-ൽ Enter അമർത്തുന്നത് മാത്രം webpage-ൽ line break ഉണ്ടാക്കുമെന്ന് കരുതുന്നു
  • Content structure നൽകേണ്ടിടത്ത് headings ഉപയോഗിക്കാതെ text വലുതാക്കാൻ പിന്നീട് CSS ഉപയോഗിക്കേണ്ട സാഹചര്യം സൃഷ്ടിക്കുന്നു
  • <hr> വെറും decorative line ആയി മാത്രം ഉപയോഗിക്കുന്നു

ഈ അധ്യായത്തിന്റെ സംഗ്രഹം

  • HTML-ൽ <h1> മുതൽ >lh6> വരെ ആറ് heading levels ഉണ്ടെന്ന് പഠിച്ചു
  • Heading levels content hierarchy വ്യക്തമാക്കാൻ ഉപയോഗിക്കുന്നുവെന്ന് മനസ്സിലാക്കി
  • <h1> page-ന്റെ പ്രധാന heading ആയി ഉപയോഗിക്കാമെന്ന് പഠിച്ചു
  • <h2> മുതൽ <h6> വരെ sections-ന്റെയും subsections-ന്റെയും hierarchy നിർമ്മിക്കാൻ ഉപയോഗിക്കാമെന്ന് മനസ്സിലാക്കി
  • <p> ഉപയോഗിച്ച് paragraphs എഴുതുന്നത് പഠിച്ചു
  • <br> ഉപയോഗിച്ച് ഒരു paragraph-ന്റെ ഉള്ളിൽ line break നൽകുന്നത് പഠിച്ചു
  • >lhr> ഉപയോഗിച്ച് thematic sections വേർതിരിക്കുന്നത് പഠിച്ചു
  • Heading level-ന്റെ appearance-നും content hierarchy-ക്കും തമ്മിലുള്ള വ്യത്യാസം മനസ്സിലാക്കി
  • Headings-ഉം paragraphs-ഉം ഉപയോഗിച്ച് structured content നിർമ്മിച്ചു

വ്യായാമങ്ങൾ

  • <h1> ഉപയോഗിച്ച് നിങ്ങളുടെ പേരിൽ ഒരു webpage heading സൃഷ്ടിക്കുക
  • നിങ്ങളുടെ വിദ്യാഭ്യാസം, hobbies, skills എന്നീ വിഷയങ്ങൾക്ക് <h2> headings ഉപയോഗിക്കുക
  • ഓരോ <h2> heading-നും കീഴിൽ കുറഞ്ഞത് ഒരു paragraph എഴുതുക
  • ഒരു <h2> section-ന്റെ ഉള്ളിൽ രണ്ട് <h3> subsections സൃഷ്ടിക്കുക
  • ആറ് heading levels (<h1> മുതൽ <h6> വരെ) ഉപയോഗിച്ച് ഒരു ചെറിയ heading hierarchy നിർമ്മിക്കുക
  • <br> ഉപയോഗിച്ച് മൂന്ന് വരികളുള്ള ഒരു address പ്രദർശിപ്പിക്കുക
  • <hr> ഉപയോഗിച്ച് webpage-യിലെ രണ്ട് thematic sections വേർതിരിക്കുക
  • Heading-ന്റെ വലുപ്പത്തിനല്ല, content hierarchy-ക്കാണ് heading level തിരഞ്ഞെടുക്കേണ്ടതെന്ന് പരിശോധിക്കാൻ ഒരു ചെറിയ webpage നിർമ്മിക്കുക

Quiz & Self Assessment

ചോദ്യം 1 / 4
HTML-ൽ എത്ര heading levels ഉണ്ട്?

അടുത്ത അധ്യായത്തിൽ, webpage-യിലെ text-ന് കൂടുതൽ അർത്ഥവും structure-ഉം നൽകാൻ ഉപയോഗിക്കുന്ന Text Formatting elements — strong, em, mark, small, del, ins, sub, sup, code, blockquote തുടങ്ങിയവ — പഠിക്കും.