You can try something like this:
.yellow {
position: absolute;
left: 0;
width: 50px;
background-color: yellow;
}
.blue {
position: absolute;
right: 0;
width: 50px;
background-color: blue;
}
.green {
width: 100%;
}
.wrapper {
outline: 1px dotted red;
position: relative;
padding: 0 50px;
}
Fiddle: http://jsfiddle.net/audetwebdesign/ADdDE/
You need a .wrapper
containing block where you set left and right padding to accommodate the two positioned (yellow/blue) elements.
The input
element (green) has a width of 100%, so it fills up the space except for the padding on left and right.
You then use absolute positioning to place the two other elements. Since you specified their widths, you know how much padding to use.
Note
The input element has a border whose width can vary among browsers, therefore, you may see a slight variation among browsers. If you take a screen shot and count pixels, you may see that the centering is not perfect, but for the simplicity of coding, it works quite well.