Search code examples
htmlcssformsliquid-layout

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?


Solution

  • 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.