left: 0; right: 0 is different from width: 100%;

CSS

12/20/2022, 11:55:36 AM

by Leo Voon

In the width: 100% example, the element is too big because its

width = padding + margin + its parent’s width

to fix width: 100% overflow, you could use border-box on parent