1

在此处输入图像描述


我正在尝试实现屏幕截图上显示的屏幕。但我无法控制元素之间的空间。我希望它具有响应性,但我想这次我无法管​​理高分辨率屏幕布局。代码如下,我添加了屏幕的线框。当添加一些带有 prepend 的元素时,它总是会破坏我的 deams :)

文件链接:jsfiddle.net/AmhHf

![<div class="container-fluid">
  <div class="row-fluid">
    <div class="span8">
      <h1>Formulate</h1>
    </div>
    <div class="span4 pull-right">&nbsp;</div>
  </div>
  <div class="row-fluid">
    <form class="well span12">
      <div class="row-fluid">
        <div class="span12">
          <label>Formula Name</label>
          <input type="text" class="span8"> 
        </div>
        <div class="span8">&nbsp;</div>
      </div>
      <div class="row-fluid">
        <div class="span3">
          <label>My Label</label>
        </div>
        <div class="span3">
          <div class="input-prepend">
            <span class="add-on">@</span>
            <input type="text" class="input-medium"> 
          </div>
        </div>
        <div class="span3">+</div>
        <div class="span3">
          <select>
            <option>Option 1</option>
            <option>Option 2</option>
            <option>Option 3</option>
          </select>
        </div>
      </div>
      <div class="row-fluid">
        <div class="span3">
          <label>My Label</label>
        </div>
        <div class="span3">
          <div class="input-prepend">
            <span class="add-on">@</span>
            <input type="text" class="input-medium"> 
          </div>
        </div>
        <div class="span3">+</div>
        <div class="span3">
          <select>
            <option>Option 1</option>
            <option>Option 2</option>
            <option>Option 3</option>
          </select>
        </div>
      </div>
      <div class="row-fluid">
        <div class="span3">
          <label>My Label</label>
        </div>
        <div class="span3">
          <div class="input-prepend">
            <span class="add-on">@</span>
            <input type="text" class="input-medium"> 
          </div>
        </div>
        <div class="span3">+</div>
        <div class="span3">
          <select>
            <option>Option 1</option>
            <option>Option 2</option>
            <option>Option 3</option>
          </select>
        </div>
      </div>
      <div class="row-fluid"></div>
      <div class="row-fluid">
        <div class="span3">
          <label>My Label</label>
        </div>
        <div class="span3">
          <div class="input-prepend">
            <span class="add-on">@</span>
            <input type="text" class="input-medium"> 
          </div>
        </div>
        <div class="span3">+</div>
        <div class="span3">
          <select>
            <option>Option 1</option>
            <option>Option 2</option>
            <option>Option 3</option>
          </select>
        </div>
      </div>
      <div class="row-fluid">
        <div class="form-actions pull-right">
          <button type="submit" class="btn btn-primary">Submit</button>
          <input type="reset" class="btn" value="Reset"> 
        </div>
      </div>
    </form>
  </div>
</div>][3] 

编辑:

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pagetitle</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<!-- HTML5 shim for IE backwards compatibility -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
4

1 回答 1

2

这似乎与将在 v3 中解决的引导程序中的错误有关。

根据该链接中的评论之一,现在您可以使用此 jQuery 片段来解决问题:

jQuery(function($) {
  $(window).resize(function() {
    $(".input-prepend, .input-append").each(function(index, group) {
      var input = $("input", group).css('width', '');
      $(".add-on, .btn", group).each(function() {
        input.css('width', '-=' + $(this).outerWidth());
      });
    });
  }).trigger('resize');
});

我建议您将输入的类别更改为input-block-level.

<div class="row-fluid">
  <div class="span3">
    <label>My Label</label>
  </div>
  <div class="span3">
    <div class="input-prepend">
        <span class="add-on">@</span>
        <input type="text" class="input-block-level"/> 
    </div>
  </div>
  <div class="span3">+</div>
  <div class="span3">
    <select class="input-block-level">
      <option>Option 1</option>
      <option>Option 2</option>
      <option>Option 3</option>
    </select>
  </div>
</div>

请参阅此更新的 jsfiddle以及第一行输入现在如何正确调整大小。

于 2013-04-10T19:11:43.927 回答