The Basics of HTML
HTML comments are comments in your source code inserted using a HTML comment Tag. Comments inserted this way are hidden, and do not show to your users.
<a> Tag, along with its
<href> attribute, creates a hyperlink to another web page, email address, location on the same page, or files.
<abbr> Tag defines an abbreviation or acronym, such as HTML or CSS.
<Address> Tag is used to define a person or organization’s contact information. It can contain a wide range of contact information, such as a physical address, email, and phone.
<area> tag defines predefined clickable areas within an image map. This allows areas on an image to be associated with a link.
<article> tag specifies self-contained content that should make sense in isolation and which can be distributed separately from the rest of the site.
<aside> tag is used to hold indirectly-related but separate content to the document’s main content. They are commonly used for sidebars, author information, pull-quotes, and call-out boxes.
<audio> Tag is used to embed a sound file in your HTML document. It can contain multiple audio sources, with the browser choosing the most suitable one.
<b> tag enables you to make text bold without assigning any extra importance.
<base> Tag specifies the base URL for all relative URLs used on your web page.
<bdi> element, or Bidirectional Isolate Element, is used to tell the browser’s bidirectional algorithm to treat it in isolation from its surrounding text.
<bdo> tag, or Bidirectional Text Override tag, allows you to override the bidirectional text algorithm by explicitly setting a direction.
<blockquote> Tag indicates that the enclosed text is a quote. It may contain a cite attribute with an URL to the quote source and a
<cite> element with a text description of the source.
The body tag is one of the most important html tags. It defines the document’s body and contains all the contents of the HTML document.
<br> tag is used to add a line break or carriage-return in HTML.
<button> element creates a clickable button and is often used to submit forms and other button functionality.
<canvas> element provides scripts with a resolution-dependent bitmap canvas. It can be used for graphs, graphics, and other images.
<caption> element is a very underused yet important element that provides a title (or caption) for HTML tables.
<cite> tag defines the title of a piece of creative work and must contain the title of that piece of work.
<code> element is used to define a fragment or piece of computer code. It will display any text wrapped by
<code> tags in the browser’s default monospace font.
<col> tag specifies common column properties for all columns within a
<colgroup> tag is used to specify a group of columns in a table.
<data> Tag links its content with a machine-readable form of that content via the value attribute.
<datalist> tag specifies a list of options for an
<input> element in the form of a drop-down box.
<dd> Tag is used to display the definition description of a term (
<dt>) in a definition list (
<del> tag indicates the content has been removed from the document. Browsers will display the
<del> element with a line running through it.
<details> tag creates a disclosure widget, that if clicked to an ‘open’ state, will show additional information. A summary or label can be specified with a
<dfn> tag is used to specify a term that is defined in the content of your web page.
<dialog> tag represents part of an application that a user interacts with, such as a dialog box or window.
<div> tag defines a container within an HTML document that has no semantic meaning on its own.
<dl> tag is used to define a description list. This element encloses a group of description terms (<dt>) along with their definition description (
<dt> tag is used to display the definition term alongside a definition description (<dd>) in a definition list (<dl>).
<em> tag is used to add semantic emphasis to words or text compared to the surrounding text.
<embed> tag is used to embed external resources into an HTML document, such as an image, web page, audio file, or video file.
<fieldset> tag is used to group a set of form controls and labels within an HTML form, optionally grouped under a common name (legend).
<figcaption> tag is a child of the
<figure> element. It is used to attach a caption to the content within the
<figure> tag is a self-contained piece of content, with an optional caption (
<figcaption>), and typically referenced as a single unit from the main flow of the document.
<footer> element represents the footer for its nearest sectioning content (such as
<section>), or sectioning root element (
<form> tag is used to create an HTML form that contains controls for submitting user information.
<h1> to <h6>
<h6> are used to define HTML headings. The headings are ranked in order of importance.
<head> element contains a collection of metadata relating to the web page.
<header> tag contains introductory content or navigational links. It may also include a logo, search form, author name, and other introductory elements.
<hr> element represents a paragraph-level thematic break. This could be a scene change in a story or a transition to another topic within a section of a reference book.
<html> tag represents the root, or top-level, element of an HTML document. It is often referred to as the root element as other elements must be descendants.
<i> tag is used to define some text in an alternative voice or mood without emphasizing it. The text usually displays in italic.
<iframe> tag represents a nested browsing context and is used to embed an HTML document in your current HTML document.
<img> tag is used to embed an image on a web page.
<input> element is a field used in HTML Forms enabling the user input data.
<ins> tag indicates the content has been inserted into the document. Browsers will display the insert element as underlined.
<kbd> tag is used to define a string of text as keyboard input or keyboard press. It can be used in combination with
<samp> to represent other more specific scenarios.
<label> tag creates a caption for an item in a form or user interface.
<legend> tag displays a caption for the parent
<li> tag is used to represent an item in a list. It should be a child of an
<ol> element (numbered list) or
<ul> element (bullet list).
<main> tag is used to represent the main content of the
<body> of a document. It contains the primary information on the page or main functionality of an app.
<map> element along with the
<img> element and any
<area>) descendants define an image map.
<mark> tag is used to highlight or mark text of particular interest or relevance, often for notational purposes or scrutiny.
<meta> tag specifies metadata, or information, about a HTML document that cannot otherwise be expressed using the
<meter> tag represents a scalar measurement within a specific range or a fractional value. When using it, a gauge or progress bar will be displayed by the browser.
<nav> tag specifies a section of a page whose purpose is to link to other pages or parts of the same page, such as navigation links.
<noscript> tag is used to display content when a browser does not support scripts or has scripts disabled.
<object> tag is a container used to embed an external resource. The resource can be an image, nested HTML, or a resource handled by a plugin.
<ol> tag is used to create an ordered list, which is typically a numbered list.
<optgroup> tag is used to group a number of related options within a select element.
<option> tag is used to define an item in a
<output> tag represents the result of a calculation performed by an application or result of a user action.
<p> tag represents a paragraph.
<param> tag is used to specify parameters for an
<picture> tag contains an
<img> element along with zero or more
<source> elements to offer different images depending on the user’s screen pixel density, viewport size, image format, and more.
<pre> tag is used to define preformatted text and displays content with a fixed-width font with spaces and line breaks preserved.
<progress> tag represents the status of completion of a task.
<q> tag indicates that the enclosed text is an inline quote. It may contain a cite attribute with a link to the source.
<rp> tag is used to provide parenthesis or other content around a ruby text component where
<ruby> elements are not supported by the web browser.
<rt> element holds the text component of the
<ruby> element, which consists of the meaning or pronunciation of the
<ruby> element’s content.
<ruby> element allows a word or phrase to be marked with ruby annotations. Ruby annotations are primarily used in East Asian typography to guide pronunciation or include other annotations.
<s> tag is used to mark content that is no longer accurate or relevant with a strikethrough. It is not suitable to indicate document edits; use the
<del> element instead.
<samp> tag is used to mark up a piece of inline text representing a piece of or quoted output from a computer system or program.
<section> tag represents a generic section of a document or application and should include a thematic grouping of related content.
<select> tag creates a control that enables you to select from a set of options in the form of a drop-down list.
<slot> tag is identified by its name attribute. It allows you to define a placeholder in your template that can be filled with your markup.
<small> tag specifies the content you wish to display as small print, like side comments or copyright information.
<source> tag is used to specify multiple alternative media sources for the <video>, <audio>, and <picture> elements.
<span> tag is an inline container that can be used to mark up text or other phrasing content elements, such as <abbr>, <b>, <em>, <picture>, and more.
<strong> tag adds semantic meaning and indicates strong importance, seriousness, or urgency for its contents.
<style> tag contains CSS, a language used to style the web page or parts of it.
<sub> tag is an inline element that displays text as a subscript. The subscript text shows as smaller and with a lower baseline.
<summary> tag represents a summary, caption, or legend for its parent
<sup> tag is an inline element that displays text as a superscript. The superscript text shows as smaller and with a higher baseline.
<table> A ```<table>``` element represents data in a two-dimensional table comprising rows and columns of cells.
<tbody> tag encloses a block of table rows (
<tr> elements), which consists of the body of the table.
<td> element represents a standard data cell in a table.
<textarea> element is a multi-line field used in HTML Forms enabling the user input data.
<tfoot> tag is used to define a group of footer-related table rows.
<th> element represents a table cell used for a heading. The exact nature of the heading is determined by the scope and header attributes.
<thead> tag is used to define a group of header-related table rows.
<time> element represents a specific date, time, or duration. It must adhere to a valid syntax. You can specify a more readable (non-valid syntax) date or time by placing a valid version in an optional datetime attribute.
Defines the title for the web page. It is used in the browser title bar, browser bookmark titles, and the display title in search engine results pages.
<tr> element represents a row of table cells.
<track> element is used as a child of the
<video> elements to define a text track, such as captions, subtitles, or descriptions.
<u> tag represents a span of text that is unarticulated and rendered with a non-textual annotation, such as underlining misspelled words with a red underline. It carries semantic meaning.
<ul> tag is used to create an unordered list, which is typically a set of bullet points.
<var> element represents a variable, such as those used in mathematical expressions or programming. The element is usually displayed in italic.
<video> tag is used to embed a video player in your HTML document. It can contain multiple video sources, with the browser choosing the most suitable one.
A ```<wbr> specifies a word break opportunity. You can insert it into long words to select where it is ok for the browser to insert a word-break, which would usually have not done so.
The target attribute specifies how to open a linked document.
_blankOpens the linked document in a new window or tab
_selfOpens the linked document in the same frame as it was clicked (this is default)
_parentOpens the linked document in the parent frame
_topOpens the linked document in the full body of the window
framenameOpens the linked document in the named iframe
The target Attribute can be used with the following elements:
<a> <area> <base> <form>
HTML Global Attributes
accesskey attribute allows you to specify a keyboard shortcut to focus or activate a specific element.
class global attribute specifies one or more class names for an HTML element.
contenteditable attribute specifies whether an element should be editable by the user.
dir attribute specifies the direction of the element’s text.
draggable attribute specifies whether the element can be dragged either via native browser functionality, or with the Drag and Drop API.
hidden attribute is a boolean that specifies that an element is not relevant and should not be displayed by the browser.
id attribute specifies a unique identifier for an HTML element.
integrity attribute is used with a <script> element to enable a browser (or other user agents) to verify that a fetched resource has not been manipulated.
lang attribute specifies the language of an element’s content.
spellcheck attribute specifies whether the element should have its spelling and grammar checked.
style attribute specifies an inline CSS style for an element.
tabindex attribute specifies that its element can be focused the order it can be tabbed when navigating.
title attribute specifies additional information about an element, commonly in the form of a tooltip when the mouse hovers over the element.
translate attribute specifies whether the element should be translated or not when a page is localized, for example by Google Translate.
New HTML TutorialsView all
New HTML PodcastsView all
In this Hasty Treat, Scott and Wes talk about margins. There are a lot of techniques for dealing with margins - padding instead of margin, only margin or padding bottom, Flexbox for everything, Grid for everything, or a spacing Div. Sentry - Sponsor Find out about Sentry’s Dex Confer0
HTML over Websockets is all the rage
[00:00:25] Jason tells us about his busy Black Friday weekend and having to use Rails Autoscale, and Chris mentions Shopify’s graph showing their traffic for the weekend. [00:02:51] Jason tells us what’s new in the Ruby on Rails world and mentions RC2, and Chris tested Jumpstart Pro a0
Hype for Hyperscript
Dynamic HTML with htmx
On this episode we have Carson from Big Sky Software on to discuss how his htmx library is an extension to HTML that brings needed dynamic functionality to the modern web without bringing complexity. Joined by Ben Croker from PutYourLightsOn, we discuss the type of problems that htm0