I have a yellow top bar that is fixed in position and spans 100% of the width. Inside this bar, there is a red div with fluid width on the left and a green div containing an input element on the right.
- The input element needs to take up the remaining space in the top bar, covering all of the yellow area regardless of the width of the red div.
- I prefer not to add any additional HTML elements, so I am looking for a CSS solution using the existing structure provided below.
- While JavaScript could easily solve this problem, I am trying to avoid using it for now.
Sample code: http://jsfiddle.net/qhoc/jBQDB/2/
In the current setup, setting right: 0
for .input input
did not work as expected. There is still some yellow space visible on the right side, indicating that the width of the input element did not expand properly. I also experimented with position: absolute
without much success.
Any help would be greatly appreciated!