Chapter 18m

HTML Editors

HTML Editor തിരഞ്ഞെടുക്കാനും, ആദ്യ HTML File സൃഷ്ടിക്കാനും, ശരിയായ രീതിയിൽ Save ചെയ്യാനും, Browser-ൽ Web Page കാണാനും പഠിക്കാം. Notepad, TextEdit, Visual Studio Code എന്നിവ ഉപയോഗിച്ചുള്ള ഘട്ടം ഘട്ടമായുള്ള നിർദ്ദേശങ്ങൾ അറിയുക.

മുൻ അധ്യായത്തിൽ HTML എന്താണെന്നും ഒരു Basic HTML Document എങ്ങനെയാണ് ക്രമീകരിച്ചിരിക്കുന്നതെന്നും നിങ്ങൾ പഠിച്ചു.

ഇപ്പോൾ നിങ്ങളുടെ സ്വന്തം HTML Code എഴുതാനുള്ള സമയമാണ്!

ഒരു HTML Web Page സൃഷ്ടിക്കാൻ നിങ്ങൾക്ക് ഒരു Text Editor അല്ലെങ്കിൽ Code Editor ആവശ്യമാണ്. Notepad അല്ലെങ്കിൽ TextEdit പോലുള്ള ലളിതമായ Application ഉപയോഗിച്ച് തുടങ്ങാം. അല്ലെങ്കിൽ Visual Studio Code പോലുള്ള പ്രത്യേക Code Editor ഉപയോഗിക്കാം.

ഈ അധ്യായത്തിൽ ഒരു Editor എങ്ങനെ തിരഞ്ഞെടുക്കാം, നിങ്ങളുടെ ആദ്യ HTML File എങ്ങനെ സൃഷ്ടിക്കാം, അത് ശരിയായ രീതിയിൽ Save ചെയ്യാം, Browser-ൽ നിങ്ങളുടെ Web Page എങ്ങനെ കാണാം എന്നിവ പഠിക്കും.

What Is an HTML Editor?

HTML Code എഴുതാനും മാറ്റങ്ങൾ വരുത്താനും നിയന്ത്രിക്കാനും ഉപയോഗിക്കുന്ന Application ആണ് HTML Editor.

HTML Pages സൃഷ്ടിക്കാൻ വിലകൂടിയ Software ആവശ്യമില്ല. തുടങ്ങാൻ ഒരു Basic Text Editor പോലും മതിയാകും.

സാധാരണയായി രണ്ട് തരത്തിലുള്ള Editors ഉണ്ട്:

1. Basic Text Editors

Plain Text-ഉം Code-ഉം എഴുതുന്നതിനുള്ള ലളിതമായ Interface ഇവ നൽകുന്നു.

Examples:

  • Notepad (Windows)
  • TextEdit (macOS, Plain Text mode ഉപയോഗിച്ച്)

2. Dedicated Code Editors

Code എഴുതുന്നതും നിയന്ത്രിക്കുന്നതും എളുപ്പമാക്കുന്ന അധിക Features ഇവ നൽകുന്നു.

Examples:

  • Visual Studio Code (VS Code)
  • Sublime Text
  • Notepad++

Basic Text Editor vs Code Editor

FeatureBasic Text EditorCode Editor
Write HTMLYesYes
Syntax HighlightingUsually limitedYes
Auto-completionUsually limitedCommonly available
Multiple Files ManagementBasicAdvanced
ExtensionsUsually limitedOften supported
Suitable for BeginnersYesYes

W3PrimeCode Tip: Beginners-ന് ഏതെങ്കിലും ലളിതമായ Editor ഉപയോഗിക്കാം. എന്നാൽ HTML, CSS, JavaScript എന്നിവ ഒരുമിച്ച് പഠിക്കാൻ പദ്ധതിയുണ്ടെങ്കിൽ VS Code ഒരു നല്ല തിരഞ്ഞെടുപ്പാണ്.

Writing HTML Using Notepad (Windows)

Notepad ഉപയോഗിച്ച് നിങ്ങളുടെ ആദ്യ HTML Page സൃഷ്ടിക്കാൻ താഴെ പറയുന്ന ഘട്ടങ്ങൾ പിന്തുടരുക.

Step 1: Open Notepad

Start Menu തുറന്ന് Notepad എന്ന് Search ചെയ്ത് Application ആരംഭിക്കുക.

Step 2: Write HTML Code

താഴെ കൊടുത്തിരിക്കുന്ന Code Copy ചെയ്യുകയോ Type ചെയ്യുകയോ ചെയ്യുക:

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

Step 3: Save the HTML File

  1. File → Save As ക്ലിക്ക് ചെയ്യുക.
  2. File Name ആയി index.html നൽകുക.
  3. Save as type ആയി All Files തിരഞ്ഞെടുക്കുക.
  4. Option ലഭ്യമാണെങ്കിൽ Encoding ആയി UTF-8 തിരഞ്ഞെടുക്കുക.
  5. ഒരു Folder തിരഞ്ഞെടുത്ത് Save ക്ലിക്ക് ചെയ്യുക.

Important: File index.html എന്ന പേരിൽ തന്നെയാണ് Save ചെയ്തതെന്ന് ഉറപ്പാക്കുക. index.html.txt എന്ന പേരിൽ Save ചെയ്യരുത്.

Step 4: Open the HTML File in a Browser

Save ചെയ്ത index.html File കണ്ടെത്തി അതിൽ Double-click ചെയ്യുക.

അത് നിങ്ങളുടെ Default Web Browser-ൽ തുറക്കും.

മറ്റൊരു Browser തിരഞ്ഞെടുക്കാൻ File-ൽ Right-click ചെയ്ത് Open with തിരഞ്ഞെടുക്കുകയും ചെയ്യാം.

Writing HTML Using TextEdit (macOS)

നിങ്ങൾ Mac ഉപയോഗിക്കുന്നുണ്ടെങ്കിൽ TextEdit ഉപയോഗിച്ച് HTML Files സൃഷ്ടിക്കാം.

Step 1: Open TextEdit

Applications അല്ലെങ്കിൽ Spotlight Search വഴി TextEdit ആരംഭിക്കുക.

Step 2: Switch to Plain Text Mode

Format → Make Plain Text തിരഞ്ഞെടുക്കുക.

ഇത് പ്രധാനമാണ്, കാരണം HTML Code Rich Text-ന് പകരം Plain Text ആയി Save ചെയ്യണം.

Step 3: Write Your HTML Code

html
<!DOCTYPE html>
<html>
<head>
    <title>My HTML Page</title>
</head>
<body>
    <h1>Hello from Mac!</h1>
    <p>I created this page using TextEdit.</p>
</body>
</html>

Step 4: Save the File

  1. File → Save തിരഞ്ഞെടുക്കുക.
  2. File Name ആയി index.html നൽകുക.
  3. .html അല്ലെങ്കിൽ .txt ഉപയോഗിക്കണോ എന്ന് TextEdit ചോദിച്ചാൽ .html തിരഞ്ഞെടുക്കുക.
  4. ലഭ്യമാണെങ്കിൽ Plain Text Files-ലേക്ക് സ്വമേധയാ .txt ചേർക്കുന്ന Option Disable ചെയ്യുക.
  5. UTF-8 Encoding ഉപയോഗിച്ച് File Save ചെയ്യുക.

Step 5: Open in Browser

Finder-ൽ index.html കണ്ടെത്തി Safari, Chrome, Firefox അല്ലെങ്കിൽ മറ്റൊരു Web Browser ഉപയോഗിച്ച് തുറക്കുക.

Writing HTML Using Visual Studio Code

Visual Studio Code (VS Code) Microsoft വികസിപ്പിച്ചെടുത്ത ഒരു ജനപ്രിയ Code Editor ആണ്.

ഇത് താഴെ പറയുന്ന ഉപയോഗപ്രദമായ Features നൽകുന്നു:

  • Syntax Highlighting
  • Auto-completion
  • File and Folder Management
  • Integrated Terminal
  • Extensions
  • Built-in HTML language support

Steps to Create an HTML File

Step 1: VS Code-ന്റെ Official Website-ൽ നിന്ന് Download ചെയ്ത് Install ചെയ്യുക:

https://code.visualstudio.com/

Step 2: VS Code തുറക്കുക.

Step 3: File → New Text File ഉപയോഗിച്ച് ഒരു പുതിയ File സൃഷ്ടിക്കുക.

Step 4: File index.html എന്ന പേരിൽ Save ചെയ്യുക.

Step 5: താഴെ കൊടുത്തിരിക്കുന്ന HTML Code എഴുതുക:

html
<!DOCTYPE html>
<html>
<head>
    <title>Learning HTML</title>
</head>
<body>
    <h1>HTML with VS Code</h1>
    <p>Learning HTML is fun!</p>
</body>
</html>

Step 6: നിങ്ങളുടെ മാറ്റങ്ങൾ Save ചെയ്യുക.

Step 7: Save ചെയ്ത HTML File കണ്ടെത്തി Browser-ൽ തുറക്കുക.

Note: VS Code ഒരു Code Editor ആണ്, Web Browser അല്ല. VS Code-ൽ HTML File Save ചെയ്തതുകൊണ്ട് മാത്രം അതിന്റെ Rendered Output സ്വയം പ്രദർശിപ്പിക്കില്ല. Web Page കാണാൻ File ഒരു Browser-ൽ തുറക്കണം.

Try HTML Online with W3PrimeCode

W3PrimeCode Code Sandbox Free Online HTML Code Editor ഉപയോഗിച്ചും നിങ്ങൾക്ക് HTML Practice ചെയ്യാം.  Free Online HTML Code Editor

ഒരു Online HTML Editor ഉപയോഗിച്ച് Local HTML File സ്വയം സൃഷ്ടിക്കാതെ തന്നെ Code എഴുതാനും Render ചെയ്ത Result കാണാനും കഴിയും.

Example:

html
<!DOCTYPE html>
<html>
<head>
    <title>Online HTML Example</title>
</head>
<body>
    <h1>Hello, W3PrimeCode!</h1>
    <p>I am practicing HTML online.</p>
</body>
</html>

Heading-ഉം Paragraph-ഉം ഉള്ള Text മാറ്റി Code വീണ്ടും Run ചെയ്യുക.

Understanding HTML File Extensions

ഒരു HTML Document സാധാരണയായി താഴെ പറയുന്ന ഏതെങ്കിലും ഒരു Extension ഉപയോഗിച്ചാണ് Save ചെയ്യുന്നത്:

  • .html
  • .htm

ഇവ രണ്ടും HTML File Extensions ആയി അംഗീകരിക്കപ്പെട്ടവയാണ്.

Consistency നിലനിർത്തുന്നതിനായി ഈ Course-ൽ .html ഉപയോഗിക്കും.

Examples of valid File Names:

html
index.html
about.html
contact.html
portfolio.html

Common Mistake:

html
index.html.txt

ഈ പേരിലുള്ള File-ന്റെ അവസാന Extension .txt ആണ്. അതിനാൽ അത് HTML Document-ന് പകരം Text File ആയി തുറക്കപ്പെടാം.

How to Edit an Existing HTML Page

നിങ്ങളുടെ ആദ്യ HTML File Save ചെയ്ത ശേഷം, നിങ്ങൾക്ക് എപ്പോൾ വേണമെങ്കിലും അതിൽ മാറ്റങ്ങൾ വരുത്താം.

താഴെ പറയുന്ന ഘട്ടങ്ങൾ പിന്തുടരുക:

  1. നിങ്ങളുടെ Editor-ൽ index.html തുറക്കുക.
  2. മാറ്റേണ്ട Code കണ്ടെത്തുക.
  3. Content മാറ്റുക.
  4. File Save ചെയ്യുക.
  5. Browser-ലേക്ക് മടങ്ങുക.
  6. Updated Result കാണാൻ Page Refresh ചെയ്യുക.

ഉദാഹരണത്തിന്, ഇത് മാറ്റുക:

html
<h1>Welcome to HTML</h1>

ഇതിലേക്ക്:

html
<h1>Welcome to W3PrimeCode</h1>

Save ചെയ്ത ശേഷം Page Refresh ചെയ്താൽ Updated Heading Browser-ൽ കാണാം.

Common Beginner Mistakes

Mistake 1: Saving with the Wrong Extension

Incorrect:

html
index.html.txt

Correct:

html
index.html

Mistake 2: Forgetting to Save Changes

നിങ്ങൾ Code മാറ്റിയിട്ടും File Save ചെയ്തില്ലെങ്കിൽ Browser പഴയ Version തന്നെയായിരിക്കാം കാണിക്കുന്നത്.

Page Refresh ചെയ്യുന്നതിന് മുമ്പ് മാറ്റങ്ങൾ എല്ലായ്പ്പോഴും Save ചെയ്യുക.

Mistake 3: Opening the File Only in an Editor

ഒരു Code Editor HTML Source Code പ്രദർശിപ്പിക്കുന്നു.

ഒരു Browser HTML വ്യാഖ്യാനിച്ച് Render ചെയ്ത Web Page പ്രദർശിപ്പിക്കുന്നു.

വ്യത്യസ്ത ആവശ്യങ്ങൾക്കായി ഈ രണ്ട് Applications-ഉം ഉപയോഗിക്കുക.

Mistake 4: Saving HTML as Rich Text

TextEdit ഉപയോഗിക്കുമ്പോൾ HTML Code Save ചെയ്യുന്നതിന് മുമ്പ് Plain Text mode-ലേക്ക് മാറുക.

Mistake 5: Confusing Browser Tab Title with Page Heading

<title> Element ആണ് Browser Tab Title നിർവചിക്കുന്നത്.

<h1> Element ആണ് Web Page-ന്റെ ഉള്ളിൽ കാണിക്കുന്ന Heading നിർവചിക്കുന്നത്.

Practical Use Case: Create a Personal Welcome Page

welcome.html എന്ന പേരിൽ ഒരു പുതിയ File സൃഷ്ടിച്ച് താഴെ കൊടുത്തിരിക്കുന്ന Code ചേർക്കുക:

html
<!DOCTYPE html>
<html>
<head>
    <title>My Welcome Page</title>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <p>My name is Alex.</p>
    <p>I am learning HTML with W3PrimeCode.</p>
</body>
</html>

ഒരു Web Page സൃഷ്ടിക്കാൻ Editor-ഉം Browser-ഉം എങ്ങനെ ഒരുമിച്ച് പ്രവർത്തിക്കുന്നു എന്ന് ഈ ലളിതമായ Project വ്യക്തമാക്കുന്നു.

Try It Yourself

my-profile.html എന്ന പേരിൽ ഒരു File സൃഷ്ടിക്കുക.

ഈ Starter Code ഉപയോഗിക്കുക:

html
<!DOCTYPE html>
<html>
<head>
    <title>My Profile</title>
</head>
<body>
    <h1>Your Name</h1>
    <p>Your introduction goes here.</p>
</body>
</html>

Your Tasks:

  1. Your Name എന്നത് നിങ്ങളുടെ പേര് ഉപയോഗിച്ച് മാറ്റുക.
  2. നിങ്ങളുടെ താൽപ്പര്യങ്ങളെക്കുറിച്ച് ഒരു Sentence ചേർക്കുക.
  3. Browser Tab Title മാറ്റുക.
  4. .html Extension ഉപയോഗിച്ച് File Save ചെയ്യുക.
  5. File Browser-ൽ തുറക്കുക.
  6. വീണ്ടും ഒരു മാറ്റം വരുത്തി Save ചെയ്ത ശേഷം Page Refresh ചെയ്യുക.

Practice Exercises

Exercise 1 — Easy: HTML Code എഴുതാൻ ഉപയോഗിക്കാവുന്ന രണ്ട് Applications-ന്റെ പേരുകൾ പറയുക.

Exercise 2 — Easy: HTML Documents-നായി സാധാരണ ഉപയോഗിക്കുന്ന File Extension ഏതാണ്?

Exercise 3 — Medium: HTML എഴുതുന്നതിന് മുമ്പ് TextEdit Plain Text mode-ലേക്ക് മാറ്റേണ്ടത് എന്തുകൊണ്ടാണെന്ന് വിശദീകരിക്കുക.

Exercise 4 — Medium: ഒരു Heading-ഉം Paragraph-ഉം ഉൾക്കൊള്ളുന്ന about.html എന്ന File സൃഷ്ടിക്കുക.

Exercise 5 — Challenge: ഒരു പൂർണ്ണ HTML Document സൃഷ്ടിച്ച് Browser-ൽ തുറക്കുക. അതിന്റെ Heading മാറ്റി File Save ചെയ്യുക. തുടർന്ന് Page Refresh ചെയ്ത് Updated Content പ്രദർശിപ്പിക്കുക.