繁体   English   中英

Bootstrap封面图片不会在移动设备上调整大小

[英]Bootstrap cover image doesn't resize on mobile

我有以下封面图片,在桌面上看起来很棒。 头像在右侧,因此当我在移动设备上查看页面时,头像被截断了。

如何制作以便在移动时调整图像大小?

这是我的bootply: http : //www.bootply.com/KVei4t3ABg

这是我的html:

<div class="intro-header">
    <div class="container">

        <div class="row">
            <div class="col-lg-7">
                <div class="intro-message">
                    <h1>Title</h1><br>
                    <p class="subtitle">Search the most comprehensive online library </p>
                    <p class="intro-divider"></p>
                     <a href="https://www.apple.com" class="btn btn-primary btn-lg">
                       Register for a Free Account
                     </a>
                </div>
            </div>
        </div>

    </div>
    <!-- /.container -->
</div>

这是我的CSS:

.intro-header {
    padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
    padding-bottom: 50px;
    text-align: left;
    color: #f8f8f8;
    background: url(http://www.onvia.com/exchange/img/background_test.jpg) no-repeat center center;
    background-size: cover;
}

您的背景图片很宽,但相关部分很窄。 我会考虑剥离灰色背景,将其替换为CSS颜色,并始终将您的肖像设置为右边缘。 考虑到割下的肩膀,无论如何这可能是一个好主意。

.intro-header {
    padding-top: 50px;
    padding-bottom: 50px;
    text-align: left;
    color: #f8f8f8;
    background: url( ... ) no-repeat right center;
    background-size: contain;
    background-color: #ddd;
}

演示版

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM