html - Bootstrap 4 布局问题 Firefox OK / Chrome NOT
问题描述
所以,我有这部分代码,它在 Firefox 中运行得非常好,但在 chrome 或 opera 上,布局完全被破坏了,有人能发现我在这里做错了什么吗?
<div class="row broadband-block">
<div class="col-12 col-sm-8 offset-sm-2 offset-lg-3 d-flex justify-content-center flex-column broadband-main ">
<div class="row pb-4 d-flex justify-content-center justify-content-sm-start">
<picture>
<source media="(max-width: 576px)"
srcset="/img/broadband-icon@mob.png">
<source media="(max-width: 1200px)"
srcset="/img/broadband-icon@med.png">
<source media="(min-width: 1201px)"
srcset="/img/broadband-icon@1366.png">
<img class="img-fluid" src="~/img/broadband-icon@1366.png" alt="broadband-icon">
</picture>
<h2 class="electricity-header">Broadband</h2>
</div>
<h3 class="electricity-title">We offer tailored Broadband solutions to suit your business needs</h3>
<p class="electricity-text">
We pride ourselves on the quality of our products and award-winning customer service. We understand how important
the internet is to keep your business running smoothly. Benefit from high speed and consistently reliable connectivity
with speeds of up to 24mb. Great value cost-effective business broadband with a range of packages designed to give
you the flexibility to grow.<br /><br />
Whether you are a sole trader, a small to medium business or a large organisation, we have the package to suit you.<br /><br />
Not sure which solution is right for your business? Call one of our advisors
today on <span class="voice-number-color">#######</span>
</p>
<div class="col-12 col-sm-8 d-flex justify-content-center justify-content-sm-start landing-page-buttons">
<button type="button" aria-expanded="false" aria-controls="more-1" class="btn toggle-content voice-buttons">
<span class="text">CONTACT US</span>
</button>
</div>
</div>
</div>
///////// CSS /////////
.broadband-main {
padding-top: 50px;
@include for-phone {
padding-top: 20px;
padding-left: 30px;
}
}
解决方案
该类d-flex
会导致页面(和按钮)在 Chrome 上无法正确显示,但不会影响 Firefox、Safari 和其他浏览器。通过去掉它,页面现在可以在所有浏览器上正确显示。
这是CSS:
.broadband-main {
padding-top: 50px;
@include for-phone {
padding-top: 20px;
padding-left: 30px;
}
}
这是HTML:
<div class="row broadband-block container">
<div class="col-12 col-sm-8 offset-sm-2 offset-lg-3 justify-content-center flex-column broadband-main ">
<div class="row pb-4 d-flex justify-content-center justify-content-sm-start">
<picture>
<source media="(max-width: 576px)"
srcset="/img/broadband-icon@mob.png">
<source media="(max-width: 1200px)"
srcset="/img/broadband-icon@med.png">
<source media="(min-width: 1201px)"
srcset="/img/broadband-icon@1366.png">
<img class="img-fluid" src="~/img/broadband-icon@1366.png" alt="broadband-icon">
</picture>
<h2 class="electricity-header">Broadband</h2>
</div>
<h3 class="electricity-title">We offer tailored Broadband solutions to suit your business needs</h3>
<p class="electricity-text">
We pride ourselves on the quality of our products and award-winning customer service. We understand how important
the internet is to keep your business running smoothly. Benefit from high speed and consistently reliable connectivity
with speeds of up to 24mb. Great value cost-effective business broadband with a range of packages designed to give
you the flexibility to grow.<br /><br />
Whether you are a sole trader, a small to medium business or a large organisation, we have the package to suit you.<br /><br />
Not sure which solution is right for your business? Call one of our advisors
today on <span class="voice-number-color">#######</span>
</p>
<div class="col-12 col-sm-8 justify-content-center justify-content-sm-start landing-page-buttons">
<button type="button" aria-expanded="false" aria-controls="more-1" class="btn toggle-content voice-buttons">
<span class="text">CONTACT US</span>
</button>
</div>
</div>
</div>
推荐阅读
- google-forms - 如何在谷歌表单中创建定时测验
- amazon-web-services - AWS Lambda Nodejs 中无法导入模块错误
- javascript - 在模板内调用角度服务方法时如何修复“无法读取未定义的属性'...'”
- c++ - 有没有办法接受某些输入的第一个字母并检查它是否在某个列表中?
- javascript - 单击时防止触发焦点事件
- python - 如何根据python中的优先级列表选择列中的元素?
- django - Django 和 Nginx(数字海洋)
- javascript - 异步函数阻塞执行
- visual-studio - 在 Visual Studio 中记录完整的调用堆栈
- java - 如何使用服务到服务身份验证使用 Java 对 Azure Key Vault 进行本地开发?