0

I have a top logo in a div that I want to have a fixed position:

.rslogo {
 width: 1200px;
 position: fixed;
 top: 0px;
 left: 50%;
 margin-left: -600px;
 padding: 0px;
 z-index: 2;
}

I want the site to be responsive, so I add this css piece:

 @media (max-width: 1200px) {
 .rslogo {
   width: 100%;
   left: 50%;
   margin-left: -50%;
   position: fixed;
  }
 }

It works great when I manually reduce the width of the navigator screen in my desktop. BUT, when I switch to the mobile view, it doesn't work: the computed width for rslogo is still 1200px.

Just for information, I have the following line in my code:

 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

If I change the position of rslogo to "absolute", it works fine, as the computed width is then 100%, but it's not what I want, as I prefer the div containing the logo to be fixed at the top of the window.

Any ideas? Thanks.

Javi
  • 170
  • 3
  • 13

0 Answers0