我有以下封面图片,它在桌面上看起来很棒。爆头在右边,所以当我在手机上查看页面时,爆头是截止的。
如何制作图片,以便在移动时调整图片大小?
这是我的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;
}
答案 0 :(得分:2)
您的背景图片非常宽,但相关部分很窄。我会考虑剥离灰色背景,用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;
}
<强> Demo 强>