html - Bootstrap 中两行下方的巨大空间

标签 html css sass bootstrap-4 row

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

不需要的空间区域:

enter image description here

引导代码:

 <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;

        }
    }
}

最佳答案

图像定位与您在此处的 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;

        }
    }
}

关于html - Bootstrap 中两行下方的巨大空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54844394/

相关文章:

javascript - 使用 JS 编辑 CSS 媒体查询

html - 防止页面上出现第二个滚动条

php - 如何在 PHP 代码中更改文本样式和颜色

javascript - 从字符串用 node.js 编译 scss

尝试添加嵌套 div 时,Jquery .append()/.html() 在 native 移动浏览器上不起作用

jquery - 使用 Sessionstorage 中的值检查和取消检查 Jquery 中的复选框

html - 用户名=电子邮件的正确自动完成应该是什么?

javascript - 即使没有任何变化,触摸 DOM 是否会触发回流和重绘?

css - compass 中的自定义动画?

css - 在 Rails App hero-unit 中渲染图像