Bootstrap Tutorial - Create text input with full width minus button width








The following code shows how to create text input with full width minus button width.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head><!--from  w w  w  .java  2 s  . c o  m-->
<body style='margin:30px'>
  <div class="container">
    <div class="row">
      <div class="span12 pull-right">
        <form class="form-inline">
          <button type="submit" class="btn" style="float: right;">Button</button>
          <div style="overflow: hidden; padding-right: .3em;">
            <input style="height: 1.6em; width: 100%" type="text"
              placeholder="full width minus button width" />
          </div>
        </form>
      </div>
    </div>
  </div>
</body>
</html>

Click to view the demo