CSS translate X causes white space on right side of screen mobileAsk Question

问题:

I am using css translate to create a sidebar for my site. The problem is that after clicking the side bar, and collapsing it. It creates white space on the right hand side of the screen. This only happens on mobile devices.

This project is written on React JS so no jquery fixes.

enter image description here

回答1:


This worked for me!

body, html {
  overflow-x: hidden; 
}

回答2:


Edit: This seems to fix it for me:

html, body {
    width: 100vw;
    overflow-x: hidden;
}
标签: css reactjs safari
© 2014 TuiCode, Inc.