Book a free trial session and start your personalized learning journey with our expert tutors.
Fill out the form below and one of our experts will contact you shortly
Everything You Need, All in One Place
At The TutorX, we believe learning should be clear, focused, and at your fingertips. That’s why we’ve built a smart and user-friendly dashboard to empower every student on their academic journey. From live sessions and homework to performance tracking and resources—everything is seamlessly integrated to help you stay ahead with confidence.
HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. HTML was created by Tim Berners-Lee in 1991 and is maintained by the World Wide Web Consortium (W3C). HTML is not a programming language — it is a markup language that uses tags to define the structure and meaning of web content. Every webpage you see on the internet is built using HTML at its foundation.
HTML describes the structure of a web page using a series of elements represented by tags. Browsers read HTML documents and render them visually. HTML works together with CSS (for styling) and JavaScript (for behavior) to create complete, interactive web pages. The current and most widely used version is HTML5, released in 2014.
<!DOCTYPE html>: Must be the very first line. Tells the browser this is an HTML5 document. Not an HTML tag — it is a declaration.
<html>: The root element — wraps all page content. lang="en" attribute helps search engines and screen readers know the page language.
<head>: Contains metadata — information about the page not shown directly. Includes: <title>, <meta>, <link>, <style>, <script>.
<body>: Contains all visible page content — headings, paragraphs, images, links, tables, forms, etc. Everything users see and interact with.
Tag: Keywords surrounded by angle brackets < >. Tags usually come in pairs — opening <p> and closing </p>. The closing tag has a forward slash before the tag name.
Element: Everything from the opening tag to the closing tag, including the content in between. <p>Hello</p> is a paragraph element.
Attribute: Extra information added to tags. Always in the opening tag. Written as name="value". Common attributes: id, class, href, src, alt, style, type, name, placeholder, required, disabled.
Global Attributes (work on any element): id (unique identifier), class (CSS class), style (inline CSS), title (tooltip text), lang (language), hidden, tabindex, contenteditable, data-* (custom data attributes).
<p>: Defines a paragraph. Browsers automatically add space before and after paragraphs. <p>This is a paragraph.</p>
<pre>: Preformatted text — preserves spaces and line breaks exactly as written. Used for code blocks and ASCII art.
<blockquote>: Indented block quotation. cite attribute points to source URL. <q> is for inline short quotations.
<abbr>: Abbreviation with tooltip. <abbr title="HyperText Markup Language">HTML</abbr> — hovering shows the full form.
<sup> and <sub>: Superscript (x<sup>2</sup> → x²) and Subscript (H<sub>2</sub>O → H₂O).
Links (hyperlinks) are created using the <a> (anchor) tag. They connect web pages and resources together — they are the fundamental navigation mechanism of the web. The href attribute specifies the destination URL.
download attribute: <a href="report.pdf" download>Download PDF</a> — forces file download instead of opening in browser. Can specify filename: download="my-report.pdf".
Anchor links (jump links): Link to a section on the same page using id. <a href="#contact">Go to Contact</a> jumps to <section id="contact">. href="#" scrolls to top of page.
rel attribute: rel="noopener noreferrer" — security best practice for target="_blank" links. rel="nofollow" tells search engines not to follow the link. rel="canonical" prevents duplicate content issues.
Images are embedded using the self-closing <img> tag. It has no closing tag. The src attribute is required (image path) and alt is required for accessibility (describes image to screen readers and shows when image fails to load).
Basic syntax: <img src="photo.jpg" alt="A beautiful sunset" width="400" height="300">
Image attributes: src (path/URL), alt (alternate text — required!), width and height (in pixels or %), loading="lazy" (defers loading until near viewport — improves performance), title (tooltip on hover), srcset (responsive images for different screen sizes).
Image formats: JPEG/JPG — photographs, complex images. PNG — transparency support, logos, icons. GIF — simple animations. SVG — scalable vector graphics, logos. WebP — modern format, smaller file size with better quality than JPEG/PNG. AVIF — newest, best compression.
<figure> and <figcaption>: Semantic way to add a caption to an image. <figure><img src="chart.png" alt="Sales Chart"><figcaption>Q3 Sales Data</figcaption></figure>
Responsive images with <picture>: <picture><source media="(max-width:600px)" srcset="small.jpg"><img src="large.jpg" alt="..."></picture> — serves different images based on screen size.
Image as a link: Wrap <img> inside <a> tag: <a href="page.html"><img src="banner.jpg" alt="Click me"></a>
Nested lists: Lists can be nested inside each other. Place a <ul> or <ol> inside an <li> to create a sub-list. Nested lists are indented further automatically by browsers.
Navigation menus: <ul> and <li> are the standard HTML structure for navigation menus. Styled with CSS to appear horizontal or as dropdowns. Always wrap nav links in <nav><ul>...</ul></nav> for semantic HTML.
HTML tables display tabular data in rows and columns. Tables are built using <table>, <tr> (table row), <th> (table header cell), and <td> (table data cell). Tables should only be used for tabular data — not for page layout (use CSS Grid/Flexbox for layout).
Table structure tags: <thead> (header group), <tbody> (body group), <tfoot> (footer group). These semantic tags improve accessibility and allow independent scrolling of table sections. <caption> adds a title to the table.
colspan and rowspan: <td colspan="2"> — cell spans 2 columns. <td rowspan="3"> — cell spans 3 rows. Used to merge cells for complex table layouts.
<colgroup> and <col>: Apply styles to entire columns. <colgroup><col style="background:yellow"><col></colgroup> — styles the first column yellow. More efficient than styling each cell individually.
HTML forms collect user input and send it to a server for processing. Forms are created with the <form> element and contain input elements like text fields, checkboxes, radio buttons, dropdowns, and submit buttons. Forms are essential for login pages, registration, search boxes, contact forms, and any user interaction.
form attributes: action="/url" (where to send data), method="get" (data in URL, bookmark-able) or method="post" (data in body, secure for passwords), enctype="multipart/form-data" (required for file uploads), novalidate (disable HTML5 validation), autocomplete="on/off".
Input validation attributes: required (field must be filled), minlength / maxlength (character limits), min / max (for number/date), pattern="[A-Za-z]{3}" (regex pattern), disabled (field disabled), readonly (cannot edit), checked (pre-checked checkbox/radio).
<label>: Associates text with an input for accessibility. Always link label to input using for="input-id" and id="input-id". Clicking the label focuses the input. Screen readers announce the label when input is focused.
<fieldset> and <legend>: Group related form fields with a visible border. <fieldset><legend>Personal Info</legend>...</fieldset>. Improves form organization and accessibility.
<datalist>: Provides auto-complete suggestions for text input. <input list="browsers"><datalist id="browsers"><option value="Chrome"><option value="Firefox"></datalist>
Semantic HTML elements clearly describe their meaning to both the browser and the developer. They were introduced in HTML5 to replace meaningless <div> soup. Semantic elements improve SEO (search engines understand page structure better), accessibility (screen readers navigate by landmarks), and code readability.
<header>: Introductory content — logo, site title, navigation. Can appear inside <article> or <section> too (not just the page header).
<nav>: Major navigation links. A page can have multiple <nav> elements (main nav, footer nav, breadcrumbs). Not all links need to be in <nav>.
<main>: The dominant content of the page. Only one <main> per page. Should not be inside <header>, <footer>, <nav>, or <aside>.
<article>: Self-contained, independently distributable content. Blog posts, news articles, forum posts, product cards. Should make sense on its own outside the page context.
<section>: Thematic grouping of content. Each section should have a heading (<h2>–<h6>). Different from <div> — section has semantic meaning, div is purely for styling/scripting.
<aside>: Content tangentially related to the surrounding content. Sidebars, pull quotes, related links, advertisements. Visually often styled as a sidebar.
<footer>: Footer of section or page. Copyright, contact info, links, social media. Can appear inside <article> or <section> as well.
Other semantic elements: <time datetime="2024-01-15">, <address> (contact info), <details> + <summary> (accordion disclosure), <dialog> (modal dialog), <mark> (highlighted text), <progress> (progress bar), <meter> (gauge/measurement).
HTML5 is the fifth and current major version of HTML. Released in 2014 by W3C, HTML5 introduced powerful new features including semantic elements, multimedia support (audio/video without plugins), Canvas for 2D drawing, SVG, Geolocation API, Web Storage, Web Workers, and many new form input types.
<audio>: Embed audio without plugins. <audio controls><source src="song.mp3" type="audio/mpeg">Your browser does not support audio.</audio>. Attributes: controls, autoplay, loop, muted, preload. Supports MP3, WAV, OGG formats.
<video>: Embed video without Flash. <video width="640" height="360" controls><source src="movie.mp4" type="video/mp4"></video>. Attributes: controls, autoplay, loop, muted, poster (thumbnail image), preload. Supports MP4, WebM, OGG formats.
<canvas>: A drawing surface for 2D graphics via JavaScript. <canvas id="myCanvas" width="500" height="300"></canvas>. Used for charts, games, visualizations, image manipulation. The canvas API provides methods for drawing shapes, text, images, and animations.
<svg>: Scalable Vector Graphics embedded directly in HTML. Vector images that scale without pixelation. Used for logos, icons, charts, animations. Better for simple graphics; Canvas is better for complex pixel manipulation.
Web Storage APIs: localStorage (persists after browser close — no expiry), sessionStorage (cleared when tab closes). Both store key-value string pairs. localStorage.setItem("key", "value"), localStorage.getItem("key"). Better than cookies — more storage (5MB), no server transfer.
Geolocation API: navigator.geolocation.getCurrentPosition(success, error). Gets user's latitude/longitude with permission. Used in maps, weather apps, location-based services. HTTPS required.
Drag and Drop API: draggable="true" attribute on any element. Events: ondragstart, ondragover, ondrop. Enables native drag-and-drop interfaces without JavaScript libraries.
Meta tags go inside <head> and provide metadata about the HTML document. They are not displayed on the page but are read by browsers, search engines, and social media platforms. Meta tags are crucial for SEO (Search Engine Optimization), social sharing, and mobile responsiveness.
Essential meta tags:
<meta charset="UTF-8"> — character encoding (always first)
<meta name="viewport" content="width=device-width, initial-scale=1.0"> — mobile responsive
<meta name="description" content="Page description (150–160 chars)"> — shown in search results
<meta name="keywords" content="html, tutorial, web"> — keywords (less important now)
<meta name="author" content="John Doe"> — page author
<meta name="robots" content="index, follow"> — search engine instructions
Open Graph meta tags (social media sharing):
<meta property="og:title" content="Page Title">
<meta property="og:description" content="Description">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:url" content="https://example.com/page">
These control how your page appears when shared on Facebook, LinkedIn, WhatsApp.
Twitter Card tags:
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Title">
<meta name="twitter:image" content="image.jpg">
http-equiv meta tags:
<meta http-equiv="refresh" content="5;url=https://example.com"> — redirect after 5 seconds
<meta http-equiv="X-UA-Compatible" content="IE=edge"> — IE compatibility
<meta http-equiv="Content-Security-Policy" content="..."> — security policy
<link> tag in head: rel="stylesheet" (CSS file), rel="icon" (favicon), rel="canonical" (preferred URL), rel="preload" (preload critical resources), rel="alternate" (alternate versions like RSS), rel="manifest" (PWA manifest file).
Q1. What is the difference between HTML elements and HTML tags?
Ans: A tag is the markup like <p> or </p>. An element includes both the opening tag, content, and closing tag: <p>Hello</p> is the complete element. Some elements are void (self-closing) like <br>, <img>, <input> — they have only one tag and no content/closing tag.
Q2. What is the difference between <div> and <span>?
Ans: <div> is a block-level container — takes full width, starts on a new line. Used for sections, layout blocks. <span> is an inline container — takes only the width of its content, flows with text. Used for styling parts of text. Both have no semantic meaning — they are generic containers for CSS/JS hooks.
Q3. What is the difference between id and class attributes?
Ans: id must be unique on the page — only one element can have a specific id. Used for unique elements (page sections, JavaScript targets). class can be shared by multiple elements — used for styling groups. An element can have multiple classes: class="btn btn-primary large". In CSS: #id and .class.
Q4. What is the difference between <b> and <strong>, and <i> and <em>?
Ans: <b> is purely visual bold with no semantic meaning. <strong> indicates important content — semantic, affects screen readers. <i> is purely visual italic. <em> indicates emphasis — semantic, screen readers stress the word differently. Always prefer <strong> and <em> for meaningful content.
Q5. What are void elements in HTML?
Ans: Void elements are HTML elements that cannot have any child content and do not have a closing tag. Examples: <br>, <hr>, <img>, <input>, <meta>, <link>, <area>, <base>, <col>, <embed>, <source>, <track>, <wbr>. In HTML5 the trailing slash is optional: <br> and <br/> are both valid.
Q6. What is the difference between GET and POST methods in forms?
Ans: GET — data appended to URL as query string (?name=Alice&age=25). Visible in browser bar, bookmarkable, cached, limited to ~2000 chars. Used for search forms, filters. POST — data sent in request body. Not visible in URL, not cached, no size limit. Used for login, registration, file upload, any sensitive data.
Q7. What is the purpose of the alt attribute in images?
Ans: alt provides alternative text for images. Shown when image fails to load. Read by screen readers for visually impaired users (accessibility). Indexed by search engines for image SEO. Always set a descriptive alt for content images. Use alt="" (empty) for decorative images that screen readers should skip.
Q8. What is the difference between block-level and inline elements?
Ans: Block-level elements: always start on a new line, take full available width, can contain other block and inline elements. Examples: <div>, <p>, <h1>-<h6>, <ul>, <li>, <table>, <section>, <article>. Inline elements: flow within text, take only necessary width, can only contain other inline elements. Examples: <span>, <a>, <img>, <strong>, <em>, <input>.
Q9. What is the role of the <head> element?
Ans: The <head> element contains metadata not displayed on the page: <title> (browser tab title and SEO), <meta> (charset, viewport, description, OG tags), <link> (CSS stylesheets, favicon, canonical), <script> (JavaScript — preferably at end of body), <style> (internal CSS), <base> (base URL for relative links).
Q10. What are data-* attributes in HTML5?
Ans: Custom data attributes allow storing extra information on HTML elements without using non-standard attributes or JS variables. Syntax: data-[name]="value". Example: <div data-user-id="42" data-role="admin">. Access in JavaScript: element.dataset.userId (camelCase). Access in CSS: [data-role="admin"] { color: red; }. Useful for passing data between HTML and JS without hacking class names.
Q1. What does HTML stand for?
a) Hyper Text Markup Language b) High Text Machine Language c) Hyperlink Text Markup Language d) Home Tool Markup Language
Answer: a) Hyper Text Markup Language
Q2. Which tag is used to create the largest heading in HTML?
a) <h6> b) <heading> c) <h1> d) <head>
Answer: c) <h1>
Q3. Which HTML attribute is used to define inline styles?
a) class b) font c) styles d) style
Answer: d) style — style="color: red;"
Q4. Which HTML tag is used to insert a line break?
a) <lb> b) <break> c) <br> d) <line>
Answer: c) <br> — self-closing void element
Q5. What is the correct HTML for creating a hyperlink?
a) <a url="http://example.com"> b) <a href="http://example.com"> c) <link href="http://example.com"> d) <a name="http://example.com">
Answer: b) <a href="http://example.com">
Q6. Which HTML element is used to define important text?
a) <b> b) <i> c) <important> d) <strong>
Answer: d) <strong> — semantic importance, not just visual bold
Q7. What is the correct HTML for inserting an image?
a) <img href="img.jpg" alt=""> b) <image src="img.jpg" alt=""> c) <img src="img.jpg" alt=""> d) <img src="img.jpg">
Answer: c) <img src="img.jpg" alt=""> — alt is required for accessibility
Q8. Which doctype is correct for HTML5?
a) <!DOCTYPE HTML PUBLIC ...> b) <!DOCTYPE html> c) <html DOCTYPE="5"> d) <!html5>
Answer: b) <!DOCTYPE html>
Q9. Which input type is used for a calendar date picker?
a) type="calendar" b) type="datetime" c) type="date" d) type="picker"
Answer: c) type="date"
Q10. Which HTML element defines the title of a document (shown in browser tab)?
a) <head> b) <meta> c) <heading> d) <title>
Answer: d) <title> — placed inside <head>
Q11. Which attribute makes an input field mandatory in HTML5?
a) validate b) mandatory c) required d) must
Answer: c) required — <input type="text" required>
Q12. Which element is used to group table header cells?
a) <thead> b) <th> c) <header> d) <tgroup>
Answer: a) <thead> — groups the header rows, while <th> is an individual header cell
Administrator
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Reach out to us for inquiries, support, or more information about our personalized tutoring services