Syntax Recap — Web Technology
15 topic(s) — definitions, syntax, and examples.
Definition
The basic structure of an HTML document includes DOCTYPE, html, head, and body tags.
Purpose
Defines the standard skeleton for any HTML webpage.
General Syntax
Example
This is the minimal HTML5 document structure.
Definition
CSS selectors are patterns used to select HTML elements to style.
Purpose
Target specific elements for styling without modifying HTML.
General Syntax
Example
Selects all h1 elements and applies blue color and 24px font size.
Definition
A JavaScript function is a block of code designed to perform a particular task.
Purpose
Encapsulate reusable code and execute it when called.
General Syntax
Example
Defines a function that returns a greeting and displays it in an alert box.
Definition
An HTML form is used to collect user input and send it to a server.
Purpose
Capture user data through various input fields and submit it.
General Syntax
Example
Creates a simple form with a text input and submit button.
Definition
Flexbox is a one-dimensional layout method for arranging items in rows or columns.
Purpose
Create flexible, responsive layouts without floats or positioning.
General Syntax
Example
Creates a flex container that distributes children evenly with space between them.
Definition
Array methods like map, filter, and reduce transform array data.
Purpose
Process and manipulate arrays using clean functional programming patterns.
General Syntax
Example
The map method creates a new array by doubling each element.
Definition
An HTML table displays data in rows and columns using table elements.
Purpose
Present tabular data in a structured grid format.
General Syntax
Example
Creates a table with headers and one row of data.
Definition
CSS Grid is a two-dimensional layout system for creating complex web layouts.
Purpose
Create grid-based page layouts with rows and columns.
General Syntax
Example
Creates a 3-column grid with 20px gaps between items.
Definition
DOM manipulation allows JavaScript to change HTML elements and attributes dynamically.
Purpose
Update page content, styles, and structure in response to user actions.
General Syntax
Example
Finds the element with id 'demo' and changes its text content to 'Hello!'.
Definition
An event listener attaches a function to be called when a specific event occurs.
Purpose
Handle user interactions like clicks, keypresses, and form submissions.
General Syntax
Example
Adds a click event listener to a button that shows an alert when clicked.
Definition
The <a> tag creates hyperlinks to other pages or sections within the same page.
Purpose
Navigate between pages or jump to specific sections.
General Syntax
Example
Creates a hyperlink that opens in a new tab.
Definition
Media queries apply CSS styles based on device characteristics like screen width.
Purpose
Create responsive designs that adapt to different screen sizes.
General Syntax
Example
When screen width is 600px or less, the font size reduces to 14px.
Definition
JavaScript objects store key-value pairs and are the foundation of OOP in JS.
Purpose
Organize related data and functions into a single entity.
General Syntax
Example
Creates a person object with properties and a method.
Definition
HTML supports ordered (<ol>) and unordered (<ul>) lists with list items (<li>).
Purpose
Display items in a bulleted or numbered format.
General Syntax
Example
Creates an unordered bullet list with two items.
Definition
The Fetch API provides a modern way to make HTTP requests in JavaScript.
Purpose
Retrieve or send data to servers asynchronously without reloading the page.
General Syntax
Example
Fetches data from an API endpoint and logs the JSON response.