【问题标题】:Huge Space Below Two Rows in BootstrapBootstrap中两行下方的巨大空间
【发布时间】:2019-07-17 13:40:17
【问题描述】:

我正在引导程序中设计我的网站。我被这个小问题所困扰。我想删除图像下方不需要的空间。我正在使用引导程序类和 scss。我知道这是一个非常小的问题,但它如果有人纠正我做错了什么,真的会节省我的时间。只需要一点帮助。

不需要的空间区域:

引导代码:

 <section class="homepage-banner-section">

            <div class="container">
                <div class="row">
                    <div class="col-lg-4 col-md-4">
                         <div style="height: 67%;">     
                            <img src="img/home-banner-one.png" class="img-fluid mh-100" style="width: 100%; height: 100%;" alt="Responsive image">
                         </div>
                    </div>
                    <div class="col-lg-8 col-md-8">
                        <div class="row">
                            <div class="col-12">
                                <div class="therapy-text-wrapper">
                                    <h2 class="therapy-text text-center">Start you therapy now!</h2>
                                </div>
                            </div>
                            <div class="col-12">

                                <div style="height: 60%;">  
                                    <img src="img/home-banner-two.png" class="img-fluid mh-100" style="width: 100%; height: 100%;" alt="Responsive image">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12">
                        <div class="anxiety-text-wrapper">
                            <h2 class="anxiety-text text-center">Anxiety is very common:<br>
                            worldwide 1 in 14 people <br>
                            have disabling anxiety.</h2>
                        </div>
                    </div>
                </div>
            </div>

        </section>

SCSS:

.homepage-banner-section{

    padding-top: 2%;

    .therapy-text-wrapper{

        .therapy-text{

            background-color: $baby-blue;
            color:$white;
            text-align: center;
            padding: 3% 0;

        }
    }

    .anxiety-text-wrapper{
        text-align: center;
        padding: 2% 0;

        .anxiety-text{

            background-color: $baby-blue;
            color:$white;
            text-align: center;
            padding: 3% 0;
            font-family: Merriweather-Italic;
            font-style: italic;

        }
    }
}

【问题讨论】:

  • @ouchi 我在这里发布了行间距问题。如果可以请指导
  • 是否可以在您的图片中添加示例或提供图片尺寸以便我们为您制作演示?
  • 有什么方法可以私信吗?..我可以把网站的链接发给你。
  • chat.stackoverflow.com/rooms/188931/bootstrap-help 或者您可以发送您的图像尺寸吗?

标签: html css sass bootstrap-4 row


【解决方案1】:

图像定位与您在此处的 div 高度不一致。您可以尝试将margin-top: -100px; 添加到您的焦虑部分以提出它。

SASS:

.homepage-banner-section {

    padding-top: 2%;

    .therapy-text-wrapper {

        .therapy-text {

            background-color: $baby-blue;
            color:$white;
            text-align: center;
            padding: 3% 0;

        }
    }

    .anxiety-text-wrapper {
        margin-top: -100px;
        text-align: center;
        padding: 2% 0;

        @include media-breakpoint-down(md) { 
            margin-top: -10px; 
            // Change or disable the margin here for anything smaller than a medium screen
        }

        .anxiety-text {

            background-color: $baby-blue;
            color:$white;
            text-align: center;
            padding: 3% 0;
            font-family: Merriweather-Italic;
            font-style: italic;

        }
    }
}

【讨论】:

  • 试过了......它真的搞砸了响应能力......给边缘顶部 -100px 只适用于桌面版本。
  • 您可以使用引导程序为较小的设备添加媒体查询。让我添加mixin作为一个例子
  • 好吧...我也会试试这个..检查一下也会告诉你
  • 接受了您对上一个问题的回答....现在您也可以检查一下吗stackoverflow.com/questions/54842445/…
  • 谢谢,这个问题已经结束,但让我看看我是否可以创建一个代码笔并发送一些代码
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多