首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bootstrap 4布局问题Firefox正常/ Chrome NOT

Bootstrap 4布局问题Firefox正常/ Chrome NOT
EN

Stack Overflow用户
提问于 2019-01-23 00:08:54
回答 1查看 641关注 0票数 2

所以,我有这部分代码,它在firefox中工作得很好,但在chrome或opera上,布局完全被破坏了,有人能发现我做错了什么吗?

代码语言:javascript
复制
<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 /

代码语言:javascript
复制
.broadband-main {
    padding-top: 50px;

    @include for-phone {
        padding-top: 20px;
        padding-left: 30px;
    }
}
EN

回答 1

Stack Overflow用户

发布于 2019-01-23 00:33:13

d-flex类会导致页面(和按钮)在Chrome上显示不正确,但不会影响Firefox、Safari和其他浏览器。通过去掉它,页面现在可以在所有浏览器上正确显示。

下面是CSS:

代码语言:javascript
复制
.broadband-main {
    padding-top: 50px;

    @include for-phone {
        padding-top: 20px;
        padding-left: 30px;
    }
}

下面是HTML:

代码语言:javascript
复制
<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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54312198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档