[Solved] content-box of a div overlapping other elements
I was making a web project (HTML & CSS & JS used) and so far I added a title, and a div containing an img element that rotates 10 degrees clockwise when (the img element is) clicked and underneath that div is a line break (br) followed by a button. But I noticed a weird bug where if I click the img element 9 times (rotating it 90 degrees) the button starts ignoring click requests. I figured out that the reason was that the content-box of the div was too wide and that it overlapped parts of the button when it was rotated at specific degrees, I tried getting rid of the extra width but i couldn't do that without other problems rising: To start off, if i modify the width of the content-box for some reason the div's margin will be present even though i set it to 0% which creates the exact same problem, and my solutions always either modify the original size of the img element or change it's central position. So the main question is: How do i get rid of the extra width (or at least stop the div from overlapping elements that aren't its children) without affecting the position or size of both the img and the button? I don't want to show my actual project to anyone at this moment so instead i made a replication of this problem. The red background color is the div's content-box and the blue one is the img's https://code.sololearn.com/W3Y39iSnGFK7/?ref=app