Bootstrap Tutorial - Control input width with input addon








The following code shows how to control input width with input addon.

Example

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.min.css">
<style type='text/css'>
input {<!--  ww  w. ja v a2 s . c om-->
  width: 100%;
}

.input-append {
  width: 100%
}
</style>
</head>
<body>
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span8">
        <form class="form-horizontal">
          <div class="control-group">
            <label class="control-label">Field 1</label>
            <div class="controls">
              <input type="text" />
            </div>
          </div>
          <div class="control-group">
            <label class="control-label">Field 2</label>
            <div class="controls">
              <div class="input-append">
                <input type="text" /> 
                <span class="add-on">%</span>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</body>
</html>

Click to view the demo