The situation is you have a container (say a div), with some width and height something simple like this
And then, you put a child element inside
Why is this happening? The width and height of the child element is 100%, PLUS the border and padding.
To avoid the situation, add box-sizing: border-box to the child element, so that the 100% will include borders and padding, like this:
And your child element will beautifully be were you need it to be: