
James C. answered 04/10/20
Computer Science Instructor | Here to Help with All Things Web!
I may not be understanding perfectly what you are trying to do, but I believe you want to employ CSS' box-sizing property.
Here is an example I cooked up...
So, lets say you had:
You could style it with a border and keep it to 100 x 100 with:
The key is box-sizing: border-box; that is *exactly* what the property was introduced for! Keep in mind, there will only be 98px of image because border does have dimension to it :) BTW, I threw in a couple of other style properties just for giggles, e.g., padding, margin, you don't necessarily have to include those. All the best!