html - 为什么我的 Twitter Bootstrap 表单字段会溢出使用流体容器的井?

标签 html css twitter-bootstrap

更新:问题演示在这里:http://jsfiddle.net/fdB5Q/embedded/result/

从大约 767px 到 998px,表单字段比包含井宽。

小于 767px,整个表单区域换行。浏览器窗口宽度约为 200px 时呈现的页面完美显示。表单字段会像您预期的那样缩小。

为了视觉效果,请看这个非常相似的问题: Twitter Bootstrap CSS static-fluid form positioning

这是 Head 中的所有内容:

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" />
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

这是 Body 中的所有内容:

<div class="container-fluid">

<div class="row-fluid">

<div class="span8">
<p>Some Content.</p>
</div>

<div class="span4">
  <div class="well">    
    <div class="control-group">
      <label class="control-label" for="name">Your Name</label>
      <div class="controls">
      <input type="text" class="input-xlarge" name="name" id="name" maxlength="100" />
      </div>
    </div>
  </div>
</div>

</div>

</div>

我想我误解了框架的某些部分。我不应该使用液体容器吗?我做错了什么?我可以拼凑一些东西来解决这个问题,但我认为问题可能是我做错了大局。

我尝试将跨度更改为 7 和 5,但仍然出现相同的错误。我尝试了 6 和 6,但那时页面开始看起来很荒谬。其余的答案对我来说没有意义。

我将输入类别从 xlarge 改为 large。它仍然有一个溢出的宽度范围,如果显示器上有空间,我真的想要更宽的表单字段。

我想避免水平滚动条,并且我希望页面文本在智能手机的横向或纵向模式下大小相同。

更新:图片

我的问题页面:

problem page

简化版:

simple version

浏览器宽度为 200 像素的简化版本:

simple version at 200px width

最佳答案

输入html标签及其对应的.input-*样式只设置了css width。这是设计使然。

但是添加一个 css max-width:100% 将确保控制过大的输入。
例如将此添加到您的头部:

<style>
    input {
        max-width: 100%;
    } 
</style>

关于html - 为什么我的 Twitter Bootstrap 表单字段会溢出使用流体容器的井?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11855086/

相关文章:

javascript - 无法使用 CKEditor 对话框输入 javascript

html - 如何在 CSS 中为标题创建响应式底部边框?

javascript - 我怎么知道列化完成了?

javascript - 如何在 Bootstrap 中使用输入类型=密码的工具提示显示输入的密码?

html - 如何在不使用 Javascript 的情况下跟踪有多少用户点击了我网站上的特定按钮?

jquery - 如何强制嵌套列表与 jQuery Mobile 保持内联?

javascript - jQuery 动画在 anchor 标记或 anchor 标记子项中不起作用

HTML 页脚响应不完美对齐

javascript - 如何在 jquery 中更改 bootstrap glyphicon 颜色

html - 保持div水平居中