Course: CSCI 1210

Block Elements

<html>

  • Description β†’ the root element of an HTML document.
  • Attributes:
    • lang β†’ specifies the language of the document (e.g., lang="en") (optional)
    • xmlns β†’ XML namespace attribute (e.g., xmlns="http://www.w3.org/1999/xhtml") (optional)
  • Description β†’ container for metadata (title, scripts, open-graph, etc.)
  • Attributes: none

<body>

  • Description β†’ contains the content of the document.
  • Attributes:
    • onload β†’ script to be run when the document loads (optional)
    • onunload β†’ script to be run when the document is unloaded (optional)
  • Description β†’ represents introductory content or a group of navigation links.
  • Attributes: none
  • Description β†’ represents the footer for its nearest sectioning content or root element.
  • Attributes: none

<section>

  • Description β†’ represents a standalone section of content.
  • Attributes:
    • id β†’ unique identifier for the section (optional)
    • class β†’ CSS class names (optional)

<article>

  • Description β†’ represents a self-contained composition that can be independently distributed or reused.
  • Attributes:
    • id β†’ unique identifier for the article (optional)
    • class β†’ CSS class names (optional)

<aside>

  • Description β†’ represents a portion of a document whose content is indirectly related to the document’s main content.
  • Attributes:
    • id β†’ unique identifier for the aside (optional)
    • class β†’ CSS class names (optional)

<div>

  • Description β†’ generic container for flow content, used for styling or scripting purposes.
  • Attributes:
    • id β†’ unique identifier (optional)
    • class β†’ CSS class names (optional)

<figure>

  • Description β†’ represents self-contained content, often used for images, illustrations, or diagrams.
  • Attributes: none

<figcaption>

  • Description β†’ provides a caption or legend for the <figure> element.
  • Attributes: none

Inline Elements

<span>

  • Description β†’ generic inline container for phrasing content, typically used for styling purposes.
  • Attributes:
    • id β†’ unique identifier (optional)
    • class β†’ CSS class names (optional)

<a>

  • Description β†’ defines a hyperlink, linking to another location within or outside the document.
  • Attributes:
    • href β†’ specifies the URL of the linked resource (required)
    • target β†’ specifies where to open the linked document (optional)

<img>

  • Description β†’ embeds an image in the document.
  • Attributes:
    • src β†’ URL of the image (required)
    • alt β†’ alternative text for the image (required)
    • width β†’ width of the image (optional)
    • height β†’ height of the image (optional)

<strong>

  • Description β†’ indicates that its contents have strong importance, typically rendered in bold.
  • Attributes: none

<em>

  • Description β†’ indicates emphasis, typically rendered in italics.
  • Attributes: none

<code>

  • Description β†’ represents a fragment of computer code.
  • Attributes: none

<br>

  • Description β†’ produces a line break in text.
  • Attributes: none

<input>

  • Description β†’ represents a typed data field, used for form controls.
  • Attributes:
    • type β†’ specifies the type of input (e.g., text, password, checkbox) (required)
    • name β†’ name of the input (optional)
    • value β†’ default value of the input (optional)

<picture>

  • Description β†’ container for multiple sources of images for different screen sizes or formats.
  • Attributes: none

<source>

  • Description β†’ specifies multiple media resources for <picture> or <video>.
  • Attributes:
    • srcset β†’ defines the URL of the image to be used (optional but typically used)
    • media β†’ media query for responsive images (optional)
    • type β†’ MIME type of the resource (optional)

<iframe>

  • Description β†’ embeds another HTML page within the current document.
  • Attributes:
    • src β†’ URL of the embedded page (required)
    • width β†’ width of the iframe (optional)
    • height β†’ height of the iframe (optional)

Table Elements

<table>

  • Description β†’ represents a table.
  • Attributes:
    • border β†’ specifies the border width of the table (optional)
    • cellspacing β†’ specifies the space between cells (optional)
    • cellpadding β†’ specifies the space between cell content and cell borders (optional)

<thead>

  • Description β†’ groups the header content in a table.
  • Attributes: none

<tbody>

  • Description β†’ groups the main body content in a table.
  • Attributes: none

<tfoot>

  • Description β†’ groups the footer content in a table.
  • Attributes: none

<tr>

  • Description β†’ represents a row in a table.
  • Attributes:
    • rowspan β†’ specifies the number of rows a cell should span (optional)
    • colspan β†’ specifies the number of columns a cell should span (optional)

<th>

  • Description β†’ represents a header cell in a table, typically bold and centered.
  • Attributes:
    • scope β†’ indicates whether the header is for a row, column, or group of rows or columns (optional)
    • colspan β†’ specifies the number of columns the header cell should span (optional)
    • rowspan β†’ specifies the number of rows the header cell should span (optional)

<td>

  • Description β†’ represents a standard cell in a table.
  • Attributes:
    • colspan β†’ specifies the number of columns the cell should span (optional)
    • rowspan β†’ specifies the number of rows the cell should span (optional)

<caption>

  • Description β†’ provides a title or caption for the table.
  • Attributes: none