Liquid layouts and borders

261 views Asked by At

I am having problems with a liquid layout and borders, causing elements to overflow.

The structure is somewhat like this:

<div id="container">
    <label>Label</label><input type="text' />
</div>

#container{width: 100%;}
label{width: 25%;}
input{width: 75;}

I need the values to add up to 100% so the left and right edges align. Only the borders on the input make the input widths effectively width: 100% +2px;

Is there any way around this problem using just CSS?

2

There are 2 answers

0
Robert Koritnik On BEST ANSWER

Negative margins

You can try by setting negative margins:

margin: -1px;

I've changed them on your jsFiddle and textboxes did jump right of label.

0
mylesagray On

Fixed:

http://jsfiddle.net/Mutant_Tractor/eRaB5/3/

Just add

margin: -1px;
to .input-text class.