Hello Angie,
Thanks for pointing it out. I am really sorry for not explaining it properly.
The above code snippet indeed works fine,
At the time of writing this particular article, the newsletter component was within the body tag, but after some time I thought it would be best to add the newsletter to all the pages and I decided to move the newsletter component to the same level as my main div(There is a container div for my entire website which wraps around the head, navbar, main and footer elements).
In doing so I was able to bypass the padding issue even without the above code snippet, as my main tag, the section containing the newsletter, all reside at the same level.
As I mentioned in the article. there are numerous ways to fix this small issue. Thanks for sharing yours. Also, by setting max-width: 100%; you won't have to worry about the scroll space.
Hm, I double checked your website, and it doesn't look like there is a padding on that newsletter div. Also, 100vw wouldn't work on desktop, as it counts 100vw with the scrollbar width. In case of padding your 100% would be width minus the padding.
Try it ;) add padding to the main div you have there and check if your CSS still works - plot twist, it doesn't.
CSS is weird and I give you that, just please please pretty please, double check your "tutorials" before spreading the tip, that's actually not working.
Smarter solution for this kind of case is using negative margins and having width with
calc(100% + 2x your margin). Setting max width to100vwwould do the job on mobile devices tho, as there is no scroll space taken into an account when counting the viewport width.