theorise
theorise

Reputation: 7425

Liquid layouts and borders

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?

Upvotes: 0

Views: 276

Answers (2)

mylesagray
mylesagray

Reputation: 8869

Fixed:

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

Just add

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

Upvotes: 1

Robert Koritnik
Robert Koritnik

Reputation: 105029

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.

Upvotes: 2

Related Questions