I wanted to crop my background on mobile phone so the user cant scroll horizontally, it works fine when i use responsive design mode on web browser :
But when i open it on my mobile phone , it shows like this :
I know this question have been asked many times, but none of the solutions seems work for me.
this is my code :
import React from "react"
import styled from "styled-components"
const HeroBackground = () => {
return (
<Wrapper>
<Background src="/images/backgrounds/hero-background.svg" />
</Wrapper>
)
}
export default HeroBackground
const Wrapper = styled.div`
position: relative;
max-width: 1440px;
margin: auto;
overflow-x: clip !important;
`
const Background = styled.img`
position: absolute;
z-index: -1;
@media (max-width: 480px) {
max-width: 600px;
height: auto;
}
`
This is the link of my website in case if needed : https://trusting-bohr-a3f5b8.netlify.app/