Is there a way to position the <aside> element on the right side of the page?

Is there a way to position <aside> on the right side of the <body>? I attempted using <aside align=right> and aside{ align-self: right} in CSS but it didn't have any effect.

Answer №1

body {
  font-family: Calibri, Helvetica, Arial, Tahoma, sans serif;
  color: #333;
  background-color: #fff;
  padding: 0;
  margin: 0;
}

header, main, aside, footer {
   padding: 6px;
   margin: 0;
   box-sizing: border-box;
}

header {
  display: block;
  background-color: #d10373;
  color: #fff;
  }

main {
  width:100%;
  display: flex;
  flex-wrap: wrap;
}

article {
   width: 80%;
}

aside {
   width: 19%;
   background-color: #ffccff;
   }
   
footer {
  display: block;
  clear: both;
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 40px;
  background-color: #333;
  color: #fff;
  }
<body>
   <header>Your header goes here</header>
   <main>
       <article>
   Your article goes here
       </article>
       <aside>
            <ul>
              <li>This</li>
              <li>is</li>
              <li>your</li>
              <li>aside</li>
            </ul>
       </aside>
   </main>
   <footer>
   Here's a footer
   </footer>
</body>

Note that the <aside> should be placed inside the <body> and the container for the content is named <main>.

You can enhance your knowledge of HTML5 semantic elements by visiting this link.

Additionally, you can refer to this guide on using flex-wrap.

(edited to exclude unnecessary adjustments for Safari)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the reason for the jquery datatable never being reinitialized?

I've been struggling to get this right, but unfortunately, I keep failing. The issue arises when I call the filltblServicesReport function, which is primarily responsible for initializing the database. Initially, it works perfectly fine; however, upon ...

Merging HTML, CSS, and JavaScript in a single file to Generate a Bell Curve with the help of Google Charts API

I'm looking to streamline my code by combining HTML, CSS, and JS into a single HTML script for the existing "Bell Curve Using Google Charts API" project. Check out the project here I've tried putting the CSS in style tags and the JS in script t ...

Alter the input title in Vue by clicking on a list item

I currently have an input field that is connected to an unordered list containing two list items. I want to be able to change the name/ID of the input field with a simple click on one of the list items. Since the list items are not links or buttons, my go ...

Removing the dividing line between columns in an Antd table: A simple step-by-step guide

Do you notice the lines dividing each table column heading in the image? I want to get rid of these lines from the table. The table component I am using is Antd table. https://ant.design/components/table#examples https://i.stack.imgur.com/Npx5G.png ...

One of my AngularJS directives seems to be malfunctioning while the rest are working fine. Can you help me troubleshoot

Recently, I've been immersing myself in the job search process and decided to create a website as a sort of online resume while also learning AngularJS. I enrolled in the Angular course on CodeSchool and am slowly building my website to my liking. (Pl ...

"Selecting elements with CSS using the 'element'

While exploring some websites for studying purposes, I came across this code snippet. .site-header .widget-area span.but As a beginner in CSS, I'm curious to know more about the span.but part. Is it similar to the :not pseudo selector? ...

Can a C# application's design be enhanced using CSS?

While I excel at creating computer-based applications in C#, I've found that designing webpages in ASP.net can be a bit challenging. However, the power of CSS in creating stylish buttons and forms is really appealing to me. I recently searched on Goo ...

PHP revealing information

I have images stored in my database that I want to display. Check out the code snippet below $num_rows = mysql_num_rows($result41); for ($i = 1; $i <= mysql_num_rows($result41); $i++) { $row = mysql_fetch_array($result41); $upload_id = $row [& ...

Increase the width of paragraph by adding white-space padding

I am attempting to control the number of characters in a paragraph to a specific limit. If the text is shorter, I want to add whitespace padding, and if it exceeds the limit, I will truncate it with an ellipsis. All containers containing paragraphs should ...

Troubleshooting problem with rendering Safari Extjs grid

Take a look here for a simple demonstration of what I am referring to. It functions properly in Internet Explorer and Firefox, but unfortunately not in Safari. I am working with four panels that are dynamically added to a tabpanel item. Three of them are ...

Tips for creating a phone number placeholder that stays in place on a form

I'm looking to display the phone number format as a placeholder in the input field, without it disappearing as the user types. The standard HTML placeholder disappears as the user starts typing. I want the placeholder to remain visible and guide the ...

How to hide offcanvas navigation bar with one click in Bootstrap 5

There was an issue with a Bootstrap 5 project where the offcanvas menu would remain open after clicking on an anchor link. Is there a way to automatically close the offcanvas menu after clicking on an anchor link? <nav class="navbar fixed-top py ...

Focusing on a particular iframe

I am currently using the "Music" theme from Organic Theme on my WordPress site and have inserted this code to prevent SoundCloud and MixCloud oEmbeds from stretching the page width: iframe, embed { height: 100%; width: 100%; } Although the fitvid ...

Leveraging the :checked state in CSS to trigger click actions

Is there a way to revert back to the unchecked or normal state when clicking elsewhere in the window, after using the :checked state to define the action for the clicked event? ...

Placing Django Template Blocks in Custom Locations within a Page

I am attempting a task in Django Templating Language without certainty of its feasibility (without relying on JS or similar methods). The code below (from Django-Oscar) displays 3 blocks of promotions on the main page: {# Render promotions #} <div id= ...

Sorting data on-the-fly using an HTML Select drop-down menu

Looking for a way to dynamically sort data from a JavaScript object based on the user's selected option. If the user chooses ID, the data should be sorted by ID, and the same goes for Name. I've created a function and attached an onchange method ...

Utilizing Bootstrap to position a navigation bar next to a floated element causes surrounding content to be pushed

I am facing an issue with my 2 column layout where the content in the right column is being pushed down to clear the left column, resulting in a lot of vertical white space between the navigation and the content. Below is the code snippet: <head> ...

Using Flexbox for dynamic-height items with column wrapping

Struggling to create a dynamic layout that adapts differently for mobile and desktop devices? The goal is to have items sorted based on screen size, with the layout changing accordingly. Check out the main objective below, with a mobile layout on the left ...

The media print is not displaying correctly when attempting to print with JavaScript

I am attempting to print a div using the following javascript code: var divToPrint = document.getElementById(curid); var newTab = window.open('', 'Print-Window'); newTab.document.open(); newTab.document.write('<h ...

Activate the function for items that are overlapping

Here is a scenario I am working on: HTML <body> <div> <p>Text</p> </div> <body> JQuery $('div').click(function(){ $(this).find('p').fadeToggle('fast'); }); $('bo ...