Copied successfully!
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.
<!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>
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
Attributes | Description |
---|---|
accesskey | Specifies a shortcut key to activate or focus an element. |
autocapitalize | Controls whether and how text input is automatically capitalized. |
class | Specifies one or more class names for the element, allowing CSS styling and JavaScript manipulation. |
contenteditable | Specifies whether the content of an element is editable or not. |
contextmenu | Specifies a context menu for the element. |
dir | Defines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto". |
draggable | Specifies whether an element is draggable. Possible values are "true" or "false". |
enterkeyhint | Specifies the action label or icon to be shown for the enter key on virtual keyboards. |
hidden | Indicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set. |
id | Specifies a unique identifier for the element. |
inputmode | Provides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants. |
is | Allows you to specify the type of custom element. |
lang | Specifies the language of the element's content. |
nonce | A 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. |
part | Specifies the element’s part in the shadow DOM. |
slot | Assigns a slot in a shadow DOM shadow tree. |
spellcheck | Indicates whether the element is subject to spell checking. |
style | Provides inline CSS styling for the element. |
tabindex | Specifies the tab order of the element. |
title | Adds extra information about the element, displayed as a tooltip when hovering over the element. |
translate | Specifies whether the content of the element should be translated. Possible values are "yes" or "no". |
HTML Attributes | Global Attributes | Event Attributes |
---|---|---|
To view the full list | To view the full list | To view the full list |
elements | |||||
---|---|---|---|---|---|
<aside> | 6.0 | 9.0 | 4.0 | 5.0 | 11.1 |
Improve Our Platform
Did you find what you were looking for?
Learn how to contribute.Last updated on by our contributors.
View this page on GitHub• Report an issue with this content