Solution 1 :

List items come with a default indentation, using padding or margin (depending on the browser).

enter image description here

You need to override this default. Add this to your code:

.sidebar ul {
    background-color: #fff;
    list-style-type: none;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    margin-left: 0;  /* new */
    padding-left: 0; /* new */
}

jsFiddle demo

Problem :

I created a basic webpage using flexbox for the topnav and CSS Grid 12 column layout for the rest, as practice. I’m having issues with the sidenav, for some reason it has extra whitespace? I’ve tried switching to a flexbox nav, display: block, etc and I’m stumped. Should note I’m still very new to all of this and obviously still have a lot to learn, so please go easy.

/* Global styles */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-size: 16px;
}

body {
  background-color: #d8d8d8;
}

header {
  background-color: #fff;
  color: #000;
  border-bottom: 3px solid #fa58f4;
  position: absolute;
  top: 0;
  width: 100%;
}


/* Top navbar styles */

.topnav ul {
  list-style-type: none;
  display: flex;
  justify-content: center;
}

.topnav li a {
  padding: 12px 12px;
  text-decoration: none;
  color: #000;
}

.topnav a:hover {
  text-decoration: underline;
}


/* about me style */

.text-wrap {
  float: left;
  margin: 5px;
}

.about-me-wrapper>h1 {
  text-align: center;
  text-decoration: underline;
}


/* main content styles */

.content-container {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-gap: 20px;
  margin: 4em 10px;
}

aside {
  grid-column: 1 / 4;
  grid-row: 1;
}

article {
  grid-column: 4 / 10;
  grid-row: 1;
}


/* Side navbar style, still needs work */

.sidebar {
  grid-column: 10 / 13;
  grid-row: 1;
}

.sidebar ul {
  background-color: #fff;
  list-style-type: none;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  transition: 0.3s;
}

.sidebar li a {
  text-decoration: none;
  color: #000;
}

.sidebar a:hover {
  text-decoration: underline;
  color: blue;
}

.sidebar ul:hover {
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}

.about-me-wrapper {
  background-color: #fff;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  transition: 0.3s;
}

.about-me-wrapper>h1 {
  font-size: 18px;
}

.about-me-wrapper:hover {
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}

.aside-card {
  /*generic card for the left
  hand column -aside- that can be used
  multiple time */
  background-color: #fff;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  transition: 0.3s;
}

.aside-card:hover {
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
<header>
  <nav class="topnav">
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">Shop</a></li>
      <li><a href="#">About Us</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </nav>
</header>

<div class="content-container">
  <aside>
    <div class="about-me-wrapper">
      <h1>About me</h1>
      <img src="//unsplash.it/100/100" alt="random photo" class="text-wrap">
      <p>A bunch of random words A bunch of random words A bunch of random words A bunch of random words A bunch of random words A bunch of random words</p>
    </div>
    <div class="aside-card">
      <p>Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis,
        luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum</p>
    </div>
    <div class="aside-card">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper
        porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora</p>
    </div>
  </aside>
  <div class="sidebar">
    <ul>
      <li><a href="#">Example 1</a></li>
      <li><a href="#">Example 2</a></li>
      <li><a href="#">Example 3</a></li>
      <li><a href="#">Example 4</a></li>
      <li><a href="#">Example 5</a></li>
      <li><a href="#">Example 6</a></li>
      <li><a href="#">Example 7</a></li>
    </ul>
  </div>
  <article>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper
      porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. </p>

    <p>Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus
      non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. </p>

    <p>Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse
      potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. </p>

    <p>Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non
      quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet
      mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. </p>

    <p>Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis
      ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at pede suscipit sodales. </p>
  </article>
</div>

By

Leave a Reply

Your email address will not be published. Required fields are marked *