HTML <article> tagS2C Home   « HTML <article> tag

Definition

The <article> tag is used to define self contained content such as a news article or blog post that could be displayed independently of the rest of the content of the page.

The <article> tag is a block element ie. it starts on a new line and covers the whole width of the page.

A document can have more than one <article> tag.

The <article> tag was introduced in HTML5.

Example


<article>
  <h2>Independent content</h2>
  <p>Content that could be contained on its own page independently of this pages content</p>
</article>

Independent content

Content that could be contained on its own page independently of this pages content

Attributes

The following attributes can be used with the <article> tag.


<article> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <article> tag.
<article> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<article class="name">Article content here</article>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<article id="name">Article content here</article>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<article style="color:red;">Article content here</article>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<article title="Content info">Article content here</article>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<article accesskey="a">Article content here</article>
tabindexSpecifies a tab order for the element.

<article tabindex="1">Article content here</article>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<article dir="ltr">Article content here</article>
<!-- The text will flow from right to left -->
<article dir="rtl">Article content here</article>
langSpecifies a language code for the content of the element.

<article lang="en">Article content here</article>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<article spellcheck="true">Article content here</article> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<article translate="no">Article content here</article> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<article contenteditable="true">Article content here</article> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<article draggable="true">Article content here</article>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<article hidden>Article content here</article> 
<article hidden="hidden">Article content here</article> 
<article> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<article oncopy="go()">Article content here</article> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<article oncut="go()">Article content here</article>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<article onpaste="go()">Article content here</article>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<article ondrag="go()">Article content here</article>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<article ondragend="go()">Article content here</article>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<article ondragenter="go()">Article content here</article>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<article ondragleave="go()">Article content here</article>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<article ondragover="go()">Article content here</article>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<article ondragstart="go()">Article content here</article>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<article ondrop="go()">Article content here</article>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<article onblur="go()">Article content here</article>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<article onchange="go()">Article content here</article>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<article oncontextmenu="go()">Article content here</article>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<article onfocus="go()">Article content here</article>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<article oninput="go()">Article content here</article>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<article oninvalid="go()">Article content here</article>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<article onreset="go()">Article content here</article>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<article onselect="go()">Article content here</article>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<article onsubmit="go()">Article content here</article>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<article onkeydown="go()">Article content here</article>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<article onkeypress="go()">Article content here</article>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<article onkeyup="go()">Article content here</article>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<article onabort="go()">Article content here</article>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<article oncanplay="go()">Article content here</article>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<article oncanplaythrough="go()">Article content here</article>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<article oncuechange="go()">Article content here</article>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<article ondurationchange="go()">Article content here</article>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<article onemptied="go()">Article content here</article>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<article onended="go()">Article content here</article>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<article onloadeddata="go()">Article content here</article>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<article onloadedmetadata="go()">Article content here</article>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<article onloadstart="go()">Article content here</article>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<article onpause="go()">Article content here</article>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<article onplay="go()">Article content here</article>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<article onplaying="go()">Article content here</article>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<article onprogress="go()">Article content here</article>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<article onratechange="go()">Article content here</article>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<article onseeked="go()">Article content here</article>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<article onseeking="go()">Article content here</article>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<article onstalled="go()">Article content here</article>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<article onsuspend="go()">Article content here</article>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<article ontimeupdate="go()">Article content here</article>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<article onvolumechange="go()">Article content here</article>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<article onwaiting="go()">Article content here</article>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<article onclick="go()">Article content here</article>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<article ondblclick="go()">Article content here</article>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<article onmousedown="go()">Article content here</article>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<article onmousemove="go()">Article content here</article>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<article onmouseout="go()">Article content here</article>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<article onmouseover="go()">Article content here</article>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<article onmouseup="go()">Article content here</article>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<article onwheel="go()">Article content here</article>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<article onscroll="go()">Article content here</article> 
Window - NONE

Relevant HTML Tutorials

HTML Advanced - HTML Structure - Page