首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >缩小窗口时,巨型加速器和内容之间的边距会增加

缩小窗口时,巨型加速器和内容之间的边距会增加
EN

Stack Overflow用户
提问于 2016-08-24 01:23:10
回答 2查看 631关注 0票数 0

我终于可以让我的巨型图像在缩小大小时缩小到适合视口,但现在当我这样做时,我会增加底部的边距,我会让它变小。简单的解决方法?

http://codepen.io/chiggory/pen/qNGQGO

HTML

代码语言:javascript
复制
<div class="jumbotron">
    <div class="container">
    </div>
</div>

<div class="container">
    <div class="row">
        <div class="col-md-6">
            <h1>Over 27,000,000</h1>
            <h4>is the current estimate of slaves worldwide. More than at any point in human history. Every 30 seconds, another person falls victim to the human trafficking industry. Often these slaves are kidnapped or sold by families under desperate circumstances. As the demand to exploit men, women and children for manual and sexual labor increases, the average age of victims continues to fall.</h4>
            <h2>We believe</h2>
            <h4>these statistics are unacceptable. These are not mere numbers, they represent lost and stolen human lives, lives which we are relentlessly fighting for. Together we are investing our lives, devoting our unique skills and resources to bring justice and freedom to those that desperately need it, both locally, here in Buena Vista, CO, and globally. </h4>
            <br>
            <h4>Get involved and be their voice!</h4>
        </div>
    </div>
</div>

CSS

代码语言:javascript
复制
.jumbotron {
    background-image:url('http://4.bp.blogspot.com/-CIy9X0Vwlko/VFvyStJbP_I/AAAAAAAACys/Ze7QVlcVmX0/s1600/HOPE%2BLogo%2Bcopy.jpg');
    height: 600px;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: #FFFFFF;
    position: relative;
}
.jumbotron .container {
    position: relative;
    top:100px;
}
.jumbotron h1 {
      color: #fff;
      font-size: 60px;  
      font-family: 'Love Ya Like A Sister', cursive;
      font-weight: bold;
}
.jumbotron p {
    font-size: 30px;
    color: #A80000;
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-08-24 02:24:41

我把你的代码弄得乱七八糟。.jumbotronheight: 600px正在抛弃它。这是我想你要找的..。让我知道。

代码语言:javascript
复制
@media screen and (max-width: 900px) {
  body .jumbotron {
    background-size: 900px;
    background-position: left -50px center;
  }
}
.jumbotron {
    padding: 0;
  height: 90vmin; /* Here you can change the height */
  width: 100%;
    background-image:url('http://4.bp.blogspot.com/-CIy9X0Vwlko/VFvyStJbP_I/AAAAAAAACys/Ze7QVlcVmX0/s1600/HOPE%2BLogo%2Bcopy.jpg');
    background-repeat: no-repeat;
    background-size: 100%;
    background-color: #efeeec;
  background-position: left center;
  overflow: hidden;
    position: relative;
}
.jumbotron h1 {
      color: #fff;
      font-size: 60px;  
      font-family: 'Love Ya Like A Sister', cursive;
      font-weight: bold;
}
.jumbotron p {
    font-size: 30px;
    color: #A80000;
}
代码语言:javascript
复制
<div class="jumbotron">
</div>

<div class="container">
    <div class="row">
        <div class="col-md-6">
            <h1>Over 27,000,000</h1>
            <h4>is the current estimate of slaves worldwide. More than at any point in human history. Every 30 seconds, another person falls victim to the human trafficking industry. Often these slaves are kidnapped or sold by families under desperate circumstances. As the demand to exploit men, women and children for manual and sexual labor increases, the average age of victims continues to fall.</h4>
            <h2>We believe</h2>
            <h4>these statistics are unacceptable. These are not mere numbers, they represent lost and stolen human lives, lives which we are relentlessly fighting for. Together we are investing our lives, devoting our unique skills and resources to bring justice and freedom to those that desperately need it, both locally, here in Buena Vista, CO, and globally. </h4>
            <br>
            <h4>Get involved and be their voice!</h4>
        </div>
    </div>
</div>

票数 0
EN

Stack Overflow用户

发布于 2016-08-24 01:38:29

看起来我可以使用另一个答案中的background size: 100% 100%。它比contain更扭曲图像,但我可以接受它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39107303

复制
相关文章

相似问题

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