Introduction to <aside>

The <aside>tag in HTML serves as a semantic container for content that is tangentially related to the <main content>of a webpage but not crucial to its primary message. This element is commonly used to present supplementary information that enhances user understanding or provides additional context without interrupting the <main narrative flow>. Typical uses for the <aside>tag include sidebars featuring related <resources>, <pull quotes>, <advertisements>, <author bios>, or links to related <articles>. Proper use of the <aside>element can improve the accessibility of a webpage by clearly defining secondary content for screen readers and contribute to better <SEO>by structuring content in a meaningful way.

Copy to clipboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title of <aside> tag</title>
</head>
<body>

<div class="container">
<div class="main-content">
<h1>Main Content</h1>
<p>This is the main content of the page. The aside content on the right provides additional information related to this content.</p>
</div>

<aside class="sidebar">
<h2>Related Articles</h2>
<ul>
<li><a href="#"><i class="icon"></i> How to Use Semantic HTML</a></li>
<li><a href="#"><i class="icon"></i> Tips for Better Accessibility</a></li>
<li><a href="#"><i class="icon"></i> SEO Best Practices</a></li>
<li><a href="#"><i class="icon"></i> Understanding CSS Flexbox</a></li>
</ul>
</aside>
</div>

</body>
</html>
Copy to clipboard
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
background-color: rgb(18, 18, 18); /* Dark background color for body */
color: rgb(224, 224, 224); /* Light text color */
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}

.container {
display: flex;
justify-content: center;
align-items: flex-start; /* Align content to the top of the container */
gap: 20px; /* Space between main content and sidebar */
background-color: rgb(30, 30, 30); /* Darker background color for container */
padding: 20px;
border-radius: 15px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* More subtle shadow for dark theme */
}

.main-content {
width: 60%;
padding: 30px;
background-color: rgb(36, 36, 36); /* Dark background for main content */
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* Adjust shadow to suit dark theme */
border-radius: 10px;
position: relative;
z-index: 1;
color: #e0e0e0; /* Light text color */
}

.sidebar {
width: 30%;
background: linear-gradient(135deg, #333399 0%, #ff4b2b 100%); /* Dark gradient for sidebar */
padding: 30px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* Adjust shadow */
border-radius: 10px;
color: #f0f0f0; /* Light text color */
position: sticky;
top: 20px;
}

.sidebar h2 {
font-size: 1.75em;
margin-bottom: 20px;
color: #f0f0f0;
border-bottom: 2px solid rgba(255, 255, 255, 0.2);
padding-bottom: 10px;
}

.sidebar ul {
list-style-type: none;
padding: 0;
}

.sidebar ul li {
margin-bottom: 15px;
display: flex;
align-items: center;
}

.sidebar ul li a {
text-decoration: none;
color: #e0e0e0; /* Light text color for links */
font-size: 1.1em;
transition: color 0.3s ease;
display: flex;
align-items: center;
}

.sidebar ul li a:hover {
color: #ffffff; /* Brighter color on hover */
}

.sidebar ul li .icon {
width: 24px;
height: 24px;
margin-right: 10px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: inline-block;
transition: background-color 0.3s ease;
}

.sidebar ul li a:hover .icon {
background-color: #ffffff; /* Brighter background on hover */
}

@media (max-width: 768px) {
.container {
flex-direction: column;
align-items: center;
width: 90%;
}

.main-content, .sidebar {
width: 100%;
margin: 10px 0;
}
}

Global Attributes

AttributesDescription
accesskeySpecifies a shortcut key to activate or focus an element.
autocapitalizeControls whether and how text input is automatically capitalized.
classSpecifies one or more class names for the element, allowing CSS styling and JavaScript manipulation.
contenteditableSpecifies whether the content of an element is editable or not.
contextmenuSpecifies a context menu for the element.
dirDefines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto".
draggableSpecifies whether an element is draggable. Possible values are "true" or "false".
enterkeyhintSpecifies the action label or icon to be shown for the enter key on virtual keyboards.
hiddenIndicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set.
idSpecifies a unique identifier for the element.
inputmodeProvides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants.
isAllows you to specify the type of custom element.
langSpecifies the language of the element's content.
nonceA cryptographic nonce ("number used once") that can be used by Content Security Policy (CSP) to determine whether or not a given fetch will be allowed to proceed.
partSpecifies the element’s part in the shadow DOM.
slotAssigns a slot in a shadow DOM shadow tree.
spellcheckIndicates whether the element is subject to spell checking.
styleProvides inline CSS styling for the element.
tabindexSpecifies the tab order of the element.
titleAdds extra information about the element, displayed as a tooltip when hovering over the element.
translateSpecifies whether the content of the element should be translated. Possible values are "yes" or "no".
HTML AttributesGlobal AttributesEvent Attributes
To view the full list
To view the full list
To view the full list
elementsChrome BrowsersMicrosoft Edge BrowserFirefox BrowsersSafari BrowserOpera Browser
<aside>6.09.04.05.011.1