Introduction to HTML Basics and page structure tutorial

what is html

What is HTML?

  • HTML stands for HyperText Markup Language. It’s the standard language used to create web pages.
  • HTML is used to structure content on the web by using various tags to define different parts of a webpage.

Basic HTML Document Structure

  • Every HTML document starts with a <!DOCTYPE HTML> declaration to tell the browser what type of document it is.
  • The main components of an HTML document are:
  1. <html>: The root element that wraps all the content on the page.
  2. <head>: Contains metadata about the document, like the title, links to
    stylesheets, etc.
  3. <body>: Contains the content that is displayed on the page.
basic html structure

Explanation:

● The <!DOCTYPE HTML>,declaration is a required preamble.
● The <html>,element is the root of the page.
● Inside the <head>, we define the title of the page that appears in the browser tab.
● The <meta charset=”UTF-8”>,sets the character encoding for the document.
● The <body> element contains all the content that will be displayed on the webpage.

Basic HTML Tag

  1. Headings
  2. Paragraphs
  3. Lists
  4. Links

Headings

  • HTML provides six levels of headings <h1> to <h6>.
  • <h1> is the highest (largest) level heading, and <h6> is the lowest (smallest).
headings

Paragraphs

  • Paragraphs are created using the <p> tag. This is used for regular text content
paragraphs

Lists

  • HTML provides two types of lists: <ul> unordered lists tags and ordered list <ol> tags.
  • List items are wrapped inside <li> tags.
lists

Links

  • Links are created using the <a> anchor tag. The href attribute defines the destination of the link.

Example: Google.com, hostinger.com etc.

anchor tags

Attributes and Inline Elements

  • Explain attributes (e.g., href, src, alt, target).
  • Introduce inline elements like <span>, <strong> and <em>.
attributes

Inline Elements

  • Inline elements appear inside other elements without breaking the flow of the document (e.g., within paragraph).
inline elements
page structure

Introduction to Semantic HTML

What is Semantic HTML?

  • Semantic HTML introduces meaning to the web content. Instead of using generic tags like <div>, semantic elements describe the content in a meaningful way.
  • Examples of semantic elements include:
  • <header> Represents the header of the page or section.
  • <nav> Defines a navigation section.
  • <main> Represents the main content of the page.
  • <section> A standalone section of related content.
  • <footer> Represents the footer of the page or section.
semantic html
semantic html2

Building a Complete Page Structure

Steps:

1. Header Section:

  • Create a <header> element that contains a website title and navigation menu.
  • Inside the <nav>, add a list of links <ul> pointing to different sections of the page.

2. Main Content:

  • Use a <main> element for the primary content.
  • Inside <main>, use <section> tags to divide the content logically (e.g., a product section, service section, etc.).

3. Footer Section:

  • Add a <footer> element that includes some footer information (e.g., copyright).

Code Example 2: Creating a Structured Webpage:

pagestructure
page_struc2

Linking Pages Together

How to Create Internal Links:

  • Links <a> elements can link to different sections with in the same page using the id attribute.
  • For example ,clicking “About Us” in the navigation should scroll the user to the” About Us” section.
Internal links
External link

Example:

  • Click on the link About Us and you will redirected to our website about us page.
about us page code

Learn next tutorial Working with forms and inputs.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top