I'm attempting to make a div cover exactly 100% of the width on mobile devices, but no more. The code I'm using is as follows:
Here is my React code:
<div className="max-width-100vw">
HELLO I AM A UNIQUE SENTENCE HERE???
</div>
And here is the corresponding CSS code:
.max-width-100vw {
max-width: 100vw;
width: 100%;
}
However, upon inspecting the result using Chrome Dev Tools on mobile, it appears that the div exceeds 100% of the viewport width:
https://i.sstatic.net/TbJpC.png
Can anyone shed light on why this may be happening and provide a solution? While setting the width to 50% prevents overflow, I am looking for a more elegant fix.