Basic HTML

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10
At a glance
Powered by AI
The document describes various HTML tags for text formatting, links, lists, forms, media embedding and their purposes. It also covers some global attributes that can be used with tags.

Some of the main tags described are headings, paragraphs, links, lists, forms, images, audios and videos.

Attributes like src, alt, width, height can be used with images. Attributes like placeholder, required, maxlength can be used with form fields. Attributes like preload, controls can be used with audio and video.

Basic HTML <big> Not supported in HTML5. Use CSS instead.

Tag Description Defines big text

<!DOCTYPE> Defines the document type <blockquote> Defines a section that is quoted from another source

<html> Defines an HTML document <center> Not supported in HTML5. Use CSS instead.

<head> Defines information about the document Defines centered text

<title> Defines a title for the document <cite> Defines the title of a work

<body> Defines the document's body <code> Defines a piece of computer code

<h1> to <h6> Defines HTML headings <del> Defines text that has been deleted from a document

<p> Defines a paragraph <dfn> Represents the defining instance of a term

<br> Inserts a single line break <em> Defines emphasized text

<hr> Defines a thematic change in the content <font> Not supported in HTML5. Use CSS instead.

<!--...--> Defines a comment Defines font, color, and size for text

Formatting <i> Defines a part of text in an alternate voice or mood

Tag Description <ins> Defines a text that has been inserted into a document

<acronym> Not supported in HTML5. Use <abbr> instead. <kbd> Defines keyboard input

Defines an acronym <mark> Defines marked/highlighted text

<abbr> Defines an abbreviation or an acronym <meter> Defines a scalar measurement within a known range (a gauge)

<address> Defines contact information for the author/owner of a document/article <pre> Defines preformatted text

<b> Defines bold text <progress> Represents the progress of a task

<bdi> Isolates a part of text that might be formatted in a different direction from other <q> Defines a short quotation
text outside it
<rp> Defines what to show in browsers that do not support ruby annotations
<bdo> Overrides the current text direction
<rt> Defines an explanation/pronunciation of characters (for East Asian typography) <button> Defines a clickable button

<ruby> Defines a ruby annotation (for East Asian typography) <select> Defines a drop-down list

<s> Defines text that is no longer correct <optgroup> Defines a group of related options in a drop-down list

<samp> Defines sample output from a computer program <option> Defines an option in a drop-down list

<small> Defines smaller text <label> Defines a label for an <input> element

<strike>Not supported in HTML5. Use <del> or <s> instead. <fieldset> Groups related elements in a form

Defines strikethrough text <legend> Defines a caption for a <fieldset> element

<strong> Defines important text <datalist> Specifies a list of pre-defined options for input controls

<sub> Defines subscripted text <output> Defines the result of a calculation

<sup> Defines superscripted text Frames

<time> Defines a date/time Tag Description

<tt> Not supported in HTML5. Use CSS instead. <frame> Not supported in HTML5.

Defines teletype text Defines a window (a frame) in a frameset

<u> Defines text that should be stylistically different from normal text <frameset> Not supported in HTML5.

<var> Defines a variable Defines a set of frames

<wbr> Defines a possible line-break <noframes> Not supported in HTML5.

Forms and Input Defines an alternate content for users that do not support frames

Tag Description <iframe> Defines an inline frame

<form> Defines an HTML form for user input Images

<input> Defines an input control Tag Description

<textarea> Defines a multiline input control (text area) <img> Defines an image
<map> Defines a client-side image-map <ol> Defines an ordered list

<area> Defines an area inside an image-map <li> Defines a list item

<canvas> Used to draw graphics, on the fly, via scripting (usually JavaScript) <dir> Not supported in HTML5. Use <ul> instead.

<figcaption> Defines a caption for a <figure> element Defines a directory list

<figure> Specifies self-contained content <dl> Defines a description list

<picture> Defines a container for multiple image resources <dt> Defines a term/name in a description list

Audio / Video <dd> Defines a description of a term/name in a description list

Tag Description <menu> Defines a list/menu of commands

<audio> Defines sound content <menuitem> Defines a command/menu item that the user can invoke from a popup
menu
<source> Defines multiple media resources for media elements (<video>, <audio> and
<picture>) Tables

<track> Defines text tracks for media elements (<video> and <audio>) Tag Description

<video> Defines a video or movie <table> Defines a table

Links <caption> Defines a table caption

Tag Description <th> Defines a header cell in a table

<a> Defines a hyperlink <tr> Defines a row in a table

<link> Defines the relationship between a document and an external resource (most used <td> Defines a cell in a table
to link to style sheets)
<thead> Groups the header content in a table
<nav> Defines navigation links
<tbody> Groups the body content in a table
Lists
<tfoot> Groups the footer content in a table
Tag Description
<col> Specifies column properties for each column within a <colgroup> element
<ul> Defines an unordered list
<colgroup> Specifies a group of one or more columns in a table for formatting
Styles and Semantics Specifies a default color, size, and font for all text in a document

Tag Description Programming

<style> Defines style information for a document Tag Description

<div> Defines a section in a document <script>Defines a client-side script

<span> Defines a section in a document <noscript> Defines an alternate content for users that do not support client-side scripts

<header> Defines a header for a document or section <applet> Not supported in HTML5. Use <embed> or <object> instead.

<footer> Defines a footer for a document or section Defines an embedded applet

<main> Specifies the main content of a document <embed> Defines a container for an external (non-HTML) application

<section> Defines a section in a document <object> Defines an embedded object

<article> Defines an article <param> Defines a parameter for an object

<aside> Defines content aside from the page content All HTML Attributes

<details> Defines additional details that the user can view or hide Attribute Belongs to Description

<dialog> Defines a dialog box or window accept <input> Specifies the types of files that the server accepts (only for type="file")

<summary> Defines a visible heading for a <details> element accept-charset <form> Specifies the character encodings that are to be used for the form
submission
<data> Links the given content with a machine-readable translation
accesskey Global Attributes Specifies a shortcut key to activate/focus an
Meta Info element
Tag Description
action <form> Specifies where to send the form-data when a form is submitted
<head> Defines information about the document align Not supported in HTML 5. Specifies the alignment according to surrounding
<meta> Defines metadata about an HTML document elements. Use CSS instead

<base> Specifies the base URL/target for all relative URLs in a document alt <area>, <img>, <input> Specifies an alternate text when the original element fails to
display
<basefont> Not supported in HTML5. Use CSS instead.
async <script>Specifies that the script is executed asynchronously (only for external contextmenu Global Attributes Specifies a context menu for an element. The
scripts) context menu appears when a user right-clicks on the element

autocomplete <form>, <input> Specifies whether the <form> or the <input> controls <audio>, <video> Specifies that audio/video controls should be
element should have autocomplete enabled displayed (such as a play/pause button etc)

autofocus <button>, <input>, <select>, <textarea> Specifies that the element should coords <area> Specifies the coordinates of the area
automatically get focus when the page loads
data <object> Specifies the URL of the resource to be used by the object
autoplay <audio>, <video> Specifies that the audio/video will start playing as
data-* Global Attributes Used to store custom data private to the page or application
soon as it is ready

bgcolor Not supported in HTML 5. Specifies the background color of an element. Use datetime <del>, <ins>, <time> Specifies the date and time
CSS instead default <track> Specifies that the track is to be enabled if the user's preferences do not
border Not supported in HTML 5. Specifies the width of the border of an element. Use indicate that another track would be more appropriate
CSS instead defer <script>Specifies that the script is executed when the page has finished parsing
charset <meta>, <script> Specifies the character encoding (only for external scripts)

checked <input> Specifies that an <input> element should be pre-selected when the dir Global Attributes Specifies the text direction for the content in an element
page loads (for type="checkbox" or type="radio") dirname <input>, <textarea> Specifies that the text direction will be submitted
cite <blockquote>, <del>, <ins>, <q> Specifies a URL which explains the disabled <button>, <fieldset>, <input>, <optgroup>, <option>, <select>, <textarea>
quote/deleted/inserted text Specifies that the specified element/group of elements should be disabled
class Global Attributes Specifies one or more classnames for an element (refers to download <a>, <area> Specifies that the target will be downloaded when a user
a class in a style sheet) clicks on the hyperlink
color Not supported in HTML 5. Specifies the text color of an element. Use CSS draggable Global Attributes Specifies whether an element is draggable or not
instead
dropzone Global Attributes Specifies whether the dragged data is copied,
cols <textarea> Specifies the visible width of a text area moved, or linked, when dropped
colspan <td>, <th> Specifies the number of columns a table cell should span enctype<form> Specifies how the form-data should be encoded when submitting it to the
content <meta> Gives the value associated with the http-equiv or name attribute server (only for method="post")

contenteditable Global Attributes Specifies whether the content of an element is for <label>, <output> Specifies which form element(s) a label/calculation is bound
editable or not to
form <button>, <fieldset>, <input>, <label>, <meter>, <object>, <output>, <select>, maxlength <input>, <textarea> Specifies the maximum number of characters
<textarea> Specifies the name of the form the element belongs to allowed in an element

formaction <button>, <input> Specifies where to send the form-data when a form media <a>, <area>, <link>, <source>, <style> Specifies what media/device the linked
is submitted. Only for type="submit" document is optimized for

headers<td>, <th> Specifies one or more headers cells a cell is related to method <form> Specifies the HTTP method to use when sending form-data

height <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> Specifies min <input>, <meter> Specifies a minimum value
the height of the element
multiple <input>, <select> Specifies that a user can enter more than one value
hidden Global Attributes Specifies that an element is not yet, or is no longer, relevant
muted <video>, <audio> Specifies that the audio output of the video should be
high <meter> Specifies the range that is considered to be a high value muted

href <a>, <area>, <base>, <link> Specifies the URL of the page the link goes to name <button>, <fieldset>, <form>, <iframe>, <input>, <map>, <meta>, <object>,
<output>, <param>, <select>, <textarea> Specifies the name of the element
hreflang <a>, <area>, <link> Specifies the language of the linked document
novalidate <form> Specifies that the form should not be validated when submitted
http-equiv <meta> Provides an HTTP header for the information/value of the content
attribute onabort<audio>, <embed>, <img>, <object>, <video> Script to be run on abort

id Global Attributes Specifies a unique id for an element onafterprint <body> Script to be run after the document is printed

ismap <img> Specifies an image as a server-side image-map onbeforeprint <body> Script to be run before the document is printed

kind <track> Specifies the kind of text track onbeforeunload <body> Script to be run when the document is about to be
unloaded
label <track>, <option>, <optgroup> Specifies the title of the text track
onblur All visible elements. Script to be run when the element loses focus
lang Global Attributes Specifies the language of the element's content
oncanplay <audio>, <embed>, <object>, <video> Script to be run when a file is ready
list <input> Refers to a <datalist> element that contains pre-defined options for an to start playing (when it has buffered enough to begin)
<input> element
oncanplaythrough <audio>, <video> Script to be run when a file can be played all
loop <audio>, <video> Specifies that the audio/video will start over again, every the way to the end without pausing for buffering
time it is finished
onchange All visible elements. Script to be run when the value of the element is
low <meter> Specifies the range that is considered to be a low value changed
max <input>, <meter>, <progress> Specifies the maximum value
onclick All visible elements. Script to be run when the element is being clicked onerror <audio>, <body>, <embed>, <img>, <object>, <script>, <style>, <video> Script to be
run when an error occurs
oncontextmenu All visible elements. Script to be run when a context menu is triggered
onfocus All visible elements. Script to be run when the element gets focus
oncopy All visible elements. Script to be run when the content of the element is being
copied onhashchange <body> Script to be run when there has been changes to the anchor part of
the a URL
oncuechange <track> Script to be run when the cue changes in a <track> element
oninput All visible elements. Script to be run when the element gets user input
oncut All visible elements. Script to be run when the content of the element is being
cut oninvalid All visible elements. Script to be run when the element is invalid

ondblclick All visible elements. Script to be run when the element is being double- onkeydown All visible elements. Script to be run when a user is pressing a key
clicked
onkeypress All visible elements. Script to be run when a user presses a key
ondrag All visible elements. Script to be run when the element is being dragged
onkeyup All visible elements. Script to be run when a user releases a key
ondragend All visible elements. Script to be run at the end of a drag operation
onload <body>, <iframe>, <img>, <input>, <link>, <script>, <style> Script to be run
ondragenter All visible elements. Script to be run when an element has been dragged when the element is finished loading
to a valid drop target
onloadeddata <audio>, <video> Script to be run when media data is loaded
ondragleave All visible elements. Script to be run when an element leaves a valid
onloadedmetadata <audio>, <video> Script to be run when meta data (like
drop target
dimensions and duration) are loaded
ondragover All visible elements. Script to be run when an element is being dragged
over a valid drop target onloadstart <audio>, <video> Script to be run just as the file begins to load before
anything is actually loaded
ondragstart All visible elements. Script to be run at the start of a drag operation
onmousedown All visible elements. Script to be run when a mouse button is pressed
ondrop All visible elements. Script to be run when dragged element is being dropped down on an element

ondurationchange <audio>, <video> Script to be run when the length of the onmousemove All visible elements. Script to be run as long as the mouse pointer is
media changes moving over an element

onemptied <audio>, <video> Script to be run when something bad happens and onmouseout All visible elements. Script to be run when a mouse pointer moves out of
the file is suddenly unavailable (like unexpectedly disconnects) an element

onended <audio>, <video> Script to be run when the media has reach the end onmouseover All visible elements. Script to be run when a mouse pointer moves over
(a useful event for messages like "thanks for listening") an element
onmouseup All visible elements. Script to be run when a mouse button is released onsearch <input> Script to be run when the user writes something in a search field
over an element (for <input="search">)

onmousewheel All visible elements. Script to be run when a mouse wheel is being onseeked <audio>, <video> Script to be run when the seeking attribute is set to
scrolled over an element false indicating that seeking has ended

onoffline <body> Script to be run when the browser starts to work offline onseeking <audio>, <video> Script to be run when the seeking attribute is set to
true indicating that seeking is active
ononline <body> Script to be run when the browser starts to work online
onselect All visible elements. Script to be run when the element gets selected
onpagehide <body> Script to be run when a user navigates away from a page
onshow <menu> Script to be run when a <menu> element is shown as a context
onpageshow <body> Script to be run when a user navigates to a page menu
onpaste All visible elements. Script to be run when the user pastes some content
onstalled <audio>, <video> Script to be run when the browser is unable to fetch
in an element the media data for whatever reason
onpause <audio>, <video> Script to be run when the media is paused either by
onstorage <body> Script to be run when a Web Storage area is updated
the user or programmatically
onsubmit <form> Script to be run when a form is submitted
onplay <audio>, <video> Script to be run when the media is ready to start playing
onsuspend <audio>, <video> Script to be run when fetching the media data is
onplaying <audio>, <video> Script to be run when the media actually has started
stopped before it is completely loaded for whatever reason
playing.
ontimeupdate <audio>, <video> Script to be run when the playing position has
onpopstate <body> Script to be run when the window's history changes. changed (like when the user fast forwards to a different point in the media)
onprogress <audio>, <video> Script to be run when the browser is in the process ontoggle <details> Script to be run when the user opens or closes the <details>
of getting the media data element
onratechange <audio>, <video> Script to be run each time the playback rate
onunload <body> Script to be run when a page has unloaded (or the browser window
changes (like when a user switches to a slow motion or fast forward mode). has been closed)
onreset <form> Script to be run when a reset button in a form is clicked. onvolumechange <audio>, <video> Script to be run each time the volume of a
onresize <body> Script to be run when the browser window is being resized. video/audio has been changed

onscroll All visible elements. Script to be run when an element's scrollbar is being onwaiting <audio>, <video> Script to be run when the media has paused but is
scrolled expected to resume (like when the media pauses to buffer more data)
onwheel All visible elements. Script to be run when the mouse wheel rolls up or scoped <style> Specifies that the styles only apply to this element's parent element and
down over an element that element's child elements

open <details> Specifies that the details should be visible (open) to the user selected <option> Specifies that an option should be pre-selected when the
page loads
optimum <meter> Specifies what value is the optimal value for the gauge
shape <area> Specifies the shape of the area
pattern <input> Specifies a regular expression that an <input> element's value is checked
against size <input>, <select> Specifies the width, in characters (for <input>) or specifies
the number of visible options (for <select>)
placeholder <input>, <textarea> Specifies a short hint that describes the expected
value of the element sizes <img>, <link>, <source> Specifies the size of the linked resource

poster <video> Specifies an image to be shown while the video is downloading, or until the span <col>, <colgroup> Specifies the number of columns to span
user hits the play button
spellcheck Global Attributes Specifies whether the element is to have its spelling
preload <audio>, <video> Specifies if and how the author thinks the audio/video and grammar checked or not
should be loaded when the page loads
src <audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video>
readonly <input>, <textarea> Specifies that the element is read-only Specifies the URL of the media file

rel <a>, <area>, <link> Specifies the relationship between the current document srcdoc <iframe> Specifies the HTML content of the page to show in the <iframe>
and the linked document
srclang <track> Specifies the language of the track text data (required if kind="subtitles")
required <input>, <select>, <textarea> Specifies that the element must be filled
out before submitting the form srcset <img>, <source> Specifies the URL of the image to use in different situations

reversed <ol> Specifies that the list order should be descending (9,8,7...) start <ol> Specifies the start value of an ordered list

rows <textarea> Specifies the visible number of lines in a text area step <input> Specifies the legal number intervals for an input field

rowspan <td>, <th> Specifies the number of rows a table cell should span style Global Attributes Specifies an inline CSS style for an element

sandbox <iframe> Enables an extra set of restrictions for the content in an tabindex Global Attributes Specifies the tabbing order of an element
<iframe> target <a>, <area>, <base>, <form> Specifies the target for where to open the linked
scope <th> Specifies whether a header cell is a header for a column, row, or group of document or where to submit the form
columns or rows title Global Attributes Specifies extra information about an element
translate Global Attributes Specifies whether the content of an element should
be translated or not

type <button>, <embed>, <input>, <link>, <menu>, <object>, <script>, <source>, <style>
Specifies the type of element

usemap <img>, <object>Specifies an image as a client-side image-map

value <button>, <input>, <li>, <option>, <meter>, <progress>, <param> Specifies


the value of the element

width <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> Specifies


the width of the element

wrap <textarea> Specifies how the text in a text area is to be wrapped when
submitted in a form

You might also like