1
Supposing I have this structure:
<div style="width:1000px">
<div id="div1" style=""></div>
<div id="div2" style="width:300px"></div>
</div>
How to make the div1 occupy exactly the remaining space (700px) ?
Preferably considering possible div1 and div2 margins.
At first I would like to do this with CSS only, but if there is no solution it can be via javascript/jquery.
NOTE: I cannot add extra html elements. Div2 has fixed width.
OBS2: The real scenario is a Table cell. In this cell I have the input field that would be "div1" in my example. And a little magnifying glass image on the side, which would be the fixed-size div2. I want these two elements to fit together to take up the entire space of the cell
If using % instead of px solves these problems
– CesarMiguel
I added comments @Cesarmiguel
– Joao Paulo
@Joaopaulo very likely you will have problem solving on unconventional screens (smartphones and others). The Bootstrap can help you solve this and other future problem. Depending on what you are doing, it is worth thinking about using it.
– anmaia