CSS grids and Media queries

Hello all,
I’m having trouble with my #nav-list overlapping with my text when the screen gets smaller. The #nav-list width does not resize when I change the size of the screen even though the columns of the grid are given in %. Also, the #main-doc does not respect the 75% of screen-filling.

#page-container{
  background: rgb(229, 217, 254);
  padding: 10px;
  display: grid;
  grid-template-columns: 25% 75%;
  grid-template-areas:
    "header header"
    "navigation content"
    "footer footer"   
}
.nav-list{
  position: relative;
  top:50px;
  list-style:none;
  padding: 0;
  grid-area: navigation;
  position: fixed;
}
main{
  grid-area:content;
  background-color:rgb(246, 242, 254);
  padding: 10px;
  position: relative;
  top: 58px;
  margin: 0 auto;
  z-index:1;
}

I’m not sure why my media query is not responsive.
CODE:

 @media (max-width: 500px)
  { #page-container {
 display: grid;
     grid-template-columns: 100%;
  grid-template-areas:
    "header 
    "navigation"
    "content";
    }  
  } 

CHECK OUT MY CODE and visual on: https://codepen.io/IStein/pen/QWpdaWx?editors=1100

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36.

Challenge: Build a Technical Documentation Page

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

The first thing that I notice is that you forgot the closing quotes around “header”.

I’d say you should go back and revisit the #User-Stories on the naming of some of your tags.

On smaller screens the navbar should be on top of the page and from there you can deal with the responsive issues media

For your overlapping issue with the main-doc and navbar try setting the min-width and width for the navbar and margin-left for the main-doc … set all these in px .

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.