HTML div tag size problem when i add borders?

Witchy

New member
I have div tag (height: 50%;width:50%;). It fits perfectly. If I add borders
(border:5px solid black), then size changes. How can i add borders to this div without changing size?
Code Examples would be great :)
 
Leave the div alone and add borders to the thing within the div. Such as, if the div contains an image, add a border to the contained image. Or, if the div contains a paragraph, add a border to the contained paragraph. Or, if the div contains a *bunch* of stuff, then place a div *within* the div (!) and place a border around the *inner* div. (It's called a box-within-a-box, or an out-side-in-box: a classic method of structuring so as to maintain integrity of the outer box's measurement.)
 
Back
Top