Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make main and aside side by side?

How to make my main class be on a side of the aside class? Because the result is my main class is on the below of the aside class and I do not know how to figure it out

This is code:

aside {
  height: 100vh;
  width: 350px;
  justify-content: space-between;
  flex-direction: column;
}

aside ul {
  padding-top: 30%;
  list-style-type: none;
  text-align: center;
}

aside a {
  text-decoration: none;
  display: inline-block;
  font-size: 23px;
  color: $color5;
  margin: 40px;
  font-family: $font1;
  font-weight: lighter;
}

aside a:hover {
  color: $color1;
}
<aside>
  <ul>
    <li><a href="#PersonalInformation">Personal Information</a></li>
    <li class="second"><a href="#SecurityandLogin">Security and Login</a></li>
    <li><a href="Logout">Logout</a></li>
  </ul>

</aside>
<main>
  <h4>To keep you safe and secure</h4>
</main>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In such senarios, you would wanna use flexbox or css grid, like so:

.container {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1rem;
}
aside {
  min-height: 100vh;
  justify-content: space-between;
  flex-direction: column;
  border-right: 1px solid red;
}

aside ul {
  padding-top: 30%;
  list-style-type: none;
  text-align: center;
}
aside a {
  text-decoration: none;
  display: inline-block;
  font-size: 23px;
  color: $color5;
  margin: 40px;
  font-family: $font1;
  font-weight: lighter;
}

aside a:hover {
  color: $color1;
}

   
<div class="container">
  <aside>
    <ul>
      <li><a href="#PersonalInformation">Personal Information</a></li>
      <li class="second"><a href="#SecurityandLogin">Security and Login</a></li>
      <li><a href="Logout">Logout</a></li>
    </ul>

  </aside>
  <main>
    <h4>To keep you safe and secure</h4>
  </main>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading