<aside>
HTML <aside> Tag
The <aside> is one of the HTML5 elements added to define a section with additional information related to the content around the aside element. It is generally used to enhance an article with additional information or highlighting parts that can be interesting to the user. Content in aside is a stand-alone, non-essential part of the web page, and if you delete it, the main content will not be affected.
Endnotes, comments, lists of terms, reference information, a collection of links, pull-quotes, etc. are examples of information that can be within the <aside> element.
Do not confuse the <aside> element with sidebar. The sidebar is just a visual element, and the <aside> tag doesn’t systematically look like a sidebar.
Never use the <aside> element for tagging parenthesized text, because it is the component of the main flow.
You can use this element for typographical effects for the content that is separated from the main content of the page. For example, it can be used for bibliography, pull quotes, additional information comments and so on.
Syntax
Syntax
The <aside> tag comes in pairs. The content is written between the opening (<aside>) and closing (</aside>) tags.
Example of the HTML <aside> tag:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p>I like watching Game of Thrones.</p>
<aside>
<h4>Game of Thrones</h4>
<p>Game of Thrones is an American fantasy drama television series created by David Benioff and D. B. Weiss. It is an adaptation of A Song of Ice and Fire, George R. R. Martin's series of fantasy novels</p>
</aside>
</body>
</html>
Result
Example of the HTML <aside> tag with the HTML <artcile> tag:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<h1>Example of the aside tag</h1>
<aside>
<h2>Here is some heading</h2>
<p>Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De Finibus Bonorum et Malorum for use in a type specimen book.</p>
</aside>
<article>
<h3>Game of Thrones</h3>
<p>Game of Thrones is an American fantasy drama television series created by David Benioff and D. B. Weiss. It is an adaptation of A Song of Ice and Fire, George R. R. Martin's series of fantasy novels</p>
</article>
</body>
</html>
The difference between the <aside> and <div> tags
The difference between the <aside> and <div> tags
Both of these tags have the same behavior. However, they are different. Particularly, the <div> element creates a section in the web page, and the <aside> element does the same, but it contains only the content related to the main web page.
Attributes
Attributes
The <aside> tag supports the Global Attributes and the Event Attributes.
How to style <aside> tag? Common properties to alter the visual weight/emphasis/size of text in <aside> tag:
CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit. CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element. CSS font-size property sets the size of the font. CSS font-weight property defines whether the font should be bold or thick. CSS text-transform property controls text case and capitalization. CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style.
Coloring text in <aside> tag:
CSS color property describes the color of the text content and text decorations. CSS background-color property sets the background color of an element.
Text layout styles for <aside> tag:
CSS text-indent property specifies the indentation of the first line in a text block. CSS text-overflow property specifies how overflowed content that is not displayed should be signalled to the user. CSS white-space property specifies how white-space inside an element is handled. CSS word-break property specifies where the lines should be broken.
Other properties worth looking at for <aside> tag:
CSS text-shadow property adds shadow to text. CSS text-align-last property sets the alignment of the last line of the text. CSS line-height property specifies the height of a line. CSS letter-spacing property defines the spaces between letters/characters in a text. CSS word-spacing property sets the spacing between words.