I’m using Twitter Bootstrap for my page layout and I want to insert a CSS3 Box Shadow in a column.
The only problem I’m having is that the box shadow has a 1px border, and this is enough to cause my second column to wrap to the next line. If I remove the border it aligns up fine.
If I subtract 2px from the column width, it looks exactly how I want. However, I’d like to take advantage of Bootstrap’s fluid layout (which is based on percent rather than pixels), so there’s no easy way to simply make the <div> 2 pixels narrower than whatever it would otherwise be.
I really dislike the way that borders do not stay within an item’s width. Does anyone see a way to have my <div> respect the current width even with borders?
Use
and the border’s width will be added inside the box.
Here is an example with two divs that have 100×100 sizes and 20px border. The first one has ‘box-sizing’, the second one has not : http://jsfiddle.net/y3zxC/ .