HTML
Key concepts:
-
Elements:
- Basic building blocks of HTML.
- Defined by tags, e.g.,
<div>,<p>,<a>. - Usually come in pairs: opening tag (
<tag>) and closing tag (</tag>).
-
Tags:
- Special keywords surrounded by angle brackets.
- Examples:
<html>,<head>,<body>,<h1>.
-
Attributes:
- Provide additional information about elements.
- Defined within the opening tag.
- Example:
<a href="https://example.com">Link</a>(wherehrefis an attribute).
-
Nesting:
- Placing elements inside other elements.
- Example:
<div><p>Paragraph inside a div</p></div>.
-
Document Structure:
- The overall structure of an HTML document.
- Key parts:
<!DOCTYPE html>,<html>,<head>,<title>,<body>.
-
Headings:
- Define the headings of a document.
- Ranging from
<h1>to<h6>, with<h1>being the highest level.
-
Paragraphs:
- Represented by
<p>tags. - Used to define blocks of text.
- Represented by
-
Links:
- Created using the
<a>tag. - Used for hyperlinks to other pages or locations within the same page.
- Created using the
-
Images:
- Incorporated using the
<img>tag. - Example:
<img src="image.jpg" alt="Description">.
- Incorporated using the
-
Lists:
- Ordered lists (
<ol>) and unordered lists (<ul>). - List items are defined using
<li>tags.
- Ordered lists (
-
Tables:
- Defined using
<table>,<tr>(table row),<td>(table data), and<th>(table header).
- Defined using
-
Forms:
- Used to collect user input.
- Key tags include
<form>,<input>,<textarea>,<button>,<select>,<option>.
-
Semantic Elements:
- Provide meaning to the web page content.
- Examples:
<header>,<footer>,<article>,<section>,<aside>,<nav>.
-
Inline vs Block Elements:
- Inline elements: do not start on a new line (e.g.,
<span>,<a>,<img>). - Block elements: start on a new line and take up full width (e.g.,
<div>,<p>,<h1>).
- Inline elements: do not start on a new line (e.g.,
-
Comments:
- Used to insert comments in the code.
- Not displayed in the browser.
- Syntax:
<!-- Comment -->.
-
Character Entities:
- Used to display reserved characters or special symbols.
- Examples:
<for<,>for>,&for&.
-
Doctype:
- Declares the document type and version of HTML.
- Example:
<!DOCTYPE html>for HTML5.
-
Metadata:
- Information about the HTML document.
- Placed inside the
<head>tag. - Examples:
<meta>,<title>,<link>,<style>,<script>.
-
Viewport:
- Defined using a meta tag to control layout on mobile browsers.
- Example:
<meta name="viewport" content="width=device-width, initial-scale=1.0">.
-
Responsive Design:
- Techniques to ensure web pages render well on various devices and window sizes.
- Often involves media queries and flexible grid layouts.
References: