Q:

How to make input[type=text] to fill remaining horizontal space?

Does any have an idea how to do so?
I created this fiddle http://jsfiddle.net/matusko/2pctr9ok/3/ and all I want to do is, that the input behave the same way as the upper divs.
CSS:
.left {
    float:left;
    width:180px;
    background-color:#ff0000;
}
.right {
    width: 100%;
    background-color:#00FF00;
    display: block;
}

HTML:
<div>
    <div class="left">
        left
    </div>
    <div class="right">
        right
    </div>
</div>
<br/>
<div>
    <div class="left">
        left
    </div>
    <input type="text" placeholder="right" class="right"/>
</div>

I dont understand why input doesnt behave like div, even when propriety inspector says that its display is block.

A:

You can use calc in CSS to dynamically calculate the width for you.
Sample below:

.left {
  float: left;
  width: 180px;
  background-color: #ff0000;
}
.right {
  width: calc(100% - 180px);
  background-color: #00FF00;
  display: inline-block;
}
input[type="text"] {
  box-sizing: border-box;
  width: 100%;
}
<div>
  <div class="left">left</div>
  <div class="right">right</div>
</div>
<br/>
<div>
  <div class="left">left</div>
  <div class="right">
    <input type="text" placeholder="right" />
  </div>
</div>

