html - 在 Firefox 上提供与 Safari 相同的宽度

标签 html css twitter-bootstrap firefox safari

我试图让跨度在 Safari 和 Firefox 上具有相同的宽度。

我的代码可见于:Bootply

看起来像这样:

<div class="container">
<div class="row text-center">
  <div class="col-md-1">    
  </div>
  <div class="col-md-5  text-center">
    <div>               
      <div class="input-group">
      <span class="input-group-btn">
          <button class="btn btn-default" type="button" onclick="codeAddress()">
          <i class="fa fa-map-marker"></i></button>
      </span>
      <input id="address" type="text" class="form-control" placeholder="Enter your address" style="max-width:256px;width:256px;">
     </div>
<br>
           
      <div class="input-group">
        <input type="button" id="useAddress" value="Use address" class="outnowButtonOnGrey" style="width:131px;" onclick="codeAddress()">
        <span style="padding-left:7px;padding-right:7px;max-width:28px;" class="text-center">or</span>
        <input type="button" id="getCurrentLocation" value="Current location" class="outnowButtonOnGrey" style="width:131px;"><!-- 139px padding-left:20px;padding-right:20px;-->
      </div>
    </div>
  </div>
  <div class="col-md-5  text-center">  
    Some text
  </div>
  <div class="col-md-1">          
  </div>
</div>

我已经尝试了 max-width、width、min-width 的各种组合,但无法使跨度的宽度在 Safari 和 Firefox 上相同。

在 Safari 上,我得到了我想要的效果,即两个按钮与上面的输入字段左右对齐。在 Firefox 上,按钮不再右对齐。

最佳答案

span 是内联元素而不是框元素,宽度不适用于样式为“display:inline”的元素,按钮样式为“display:inline-block”——可以宽度设置。 所以在按钮上设置宽度。

关于html - 在 Firefox 上提供与 Safari 相同的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27634103/

相关文章:

javascript - Google Chrome 新标签页无法创建指向 chrome 的链接 ://apps

javascript - 在 Javascript 幻灯片动画中重新渲染定位在窗口大小调整上的 HTML 元素

javascript - 如何激活另一个 html 文件中的链接?

javascript - 根据触发按钮更改模式内容 - 标题和视频

javascript - 如何在 react 中浏览列表并制作元素时制作 Bootstrap 行

html - CSS/HTML - div 内的 div 放置不正确

javascript - 使用单选按钮更改 Div 的背景图像

jquery 第一次点击,第二次点击,第一次点击,第二次点击

css - 以下哪个值将根据最近的非静态元素定位元素?

html - Bootstrap 轮播标题无响应