html - IE 和 Firefox 忽略最大宽度样式

标签 html css twitter-bootstrap

我正在使用 Bootstrap 并且我有这些行:

<div class="col-lg-2">
    <div class="input-group">
        <span class="input-group-addon" style="max-width:70px">Serial Number</span>
        <input type="text" class="form-control" data-bind="value:DeviceSerialNumber" required />
     </div>
</div>

如您所见,我想覆盖 input-group-addon 的 Bootstrap 默认最大宽度。 在 chrome 中它工作正常,这个插件只有 70px 宽。但在 FF 和 IE 中不是。

你能告诉我为什么它只适用于 chrome 吗?

最佳答案

max-width 仅适用于与为同一元素设置的 width 相关的情况,因此 - 除非您明确设置了 widthmax-width 无法计算,因此仍未定义。

More from MDN:

The max-width CSS property is used to set the maximum width of a given element. It prevents the used value of the width property from becoming larger than the value specified for max-width.

关于html - IE 和 Firefox 忽略最大宽度样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23760980/

相关文章:

javascript - 对特定表单名称运行 ajax 调用

javascript - Datepicker getDate 方法在第二次单击时起作用并显示先前选择的日期

css - 使用 Bootstrap 的设备的不同网格结构

javascript - JS代码不起作用

html - React onChange 处理程序在页面加载期间被多次调用

html - 如何在 Django 和 Python Shell 中开始调试 POST 和 GET 请求

html - CSS 关键帧动画不适用于 SVG

html - 全高不使用 CSS 拉伸(stretch)

css - 无法更改访问的内容 :before pseudo-elements

css - jQuery UI 和 Bootstrap 主题冲突