Borders are not counted when calculating the width of an element. They are supplements to the specified width. This explains your slight inconsistencies. There is no 100% airtight solution to this problem as far as I know that will do exactly what you want (close to it, yes, but exactly, no). The most reliable is to use a table, but that isn't a valid solution for designing a page layout as you already certainly know. Another option is to float right and left but have the width specified as either a slightly lower percentage than 50 (such as 48-48) or have a width specified in px
which would allow you to calculate precisely the exact sizes that you need.
When browsers begin to uniformly implement CSS3, the box-sizing
property will be able to solve this problem. box-sizing
specifies what to take into account when calculating the size of an element. Applying box-sizing:border-box;
will take the border into account, but for the moment this isn't widely enough implemented across browsers to use reliably in your code.