Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input should have the maximum width possible

I have a similar HTML structure like this Fiddle: http://jsfiddle.net/hAMmK/3/

The HTML structure:

<span class="all">
     <span class="group-1">
         <span class="a">A</span>
         <span class="b"><input type="text" placeholder="b" /></span>
     </span>
     <span class="group-2">
         <span class="c">C</span>
         <span class="d">D</span>
     </span>  </span>

The current result with the css is

first result

but my desired result would be

Desired result

This result should be responsive, I mean, the width for the input text should be the maximum with the correct current width of the device/browser. Furthermore, I need compatibility with the most common browsers (as desktop as mobile/tablet).

What is the best way to solve this?

like image 699
fcortes Avatar asked Nov 30 '25 14:11

fcortes


1 Answers

Use CSS3 Calc: Running Demo

input[type="text"]{        
    width: calc(100% - 100px);
}

Not (yet) supported everywhere, though, and you need to know the width to subtract.

like image 151
Andrea Ligios Avatar answered Dec 03 '25 04:12

Andrea Ligios



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!