【发布时间】:2015-01-01 08:02:30
【问题描述】:
我有一个分为两个主要 div 的页面。一个是位于页面顶部的页眉,下面是一个页眉,它是页面内容的容器。头部可以在下面的代码sn-p中看到:
<link href="http://www.spareskills.com/css/compiled/theme.css" rel="stylesheet"/>
<body id="postajob">
<div class="header">
<div class="background-images img1 animated fadeInUpBig"></div>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="animated bounceInLeft">Post a job.</h2>
<p>
Find a job by filling out your application below. It really is easy.
<br>
<span class="hidden-xs">Explain the job you need and people with the right skills will be in touch</span>
</p>
</div>
</div>
</div>
</div>
</body>
下面列出了相关的 SASS/CSS:
#postajob {
-webkit-font-smoothing: antialiased;
.header {
background: $postajob_header_bg_color;
border-bottom: 1px solid $postajob_header_border_color;
height: auto;
padding-bottom: 20px;
h2 {
margin-top: 110px;
color: $postajob_header_text_color;
font-weight: 400;
font-size: 34px;
z-index: 100;
text-align: center;
@include max-sm {
margin-top: 95px;
font-size: 28px;
}
}
p {
font-weight: 300;
font-size: 17px;
color: $postajob_header_subtext_color;
z-index: 100;
text-align: center;
@include max-sm {
font-size: 14px;
}
}
.background-images {
width: 100%;
height: 50%;
&.img1 {
position: absolute;
background-repeat: no-repeat;
background-image: url('../../images/flat-icons/svg/paper-airplane.svg');
z-index: 3;
@include min-md {
background-size: 150px 150px;
top: 150px;
left: 80%;
}
@include max-md {
background-size: 100px 100px;
top: 180px;
left: 85%;
}
@include max-sm {
background-size: 40px 40px;
top: 180px;
left: 45%;
}
@include max-xs {
background-size: 40px 40px;
top: 180px;
left: 45%;
}
}
}
}
}
您可以通过调整 sn-p 的大小来查看图像相对于标题的行为方式。然而,正如您所见,这都是从将像素硬编码到样式表中。
我的问题是:无论分辨率或设备如何,如何让图像像第一个 sn-p(全尺寸时)一样贴在标题的底部?
【问题讨论】:
-
您的问题不应包含指向外部样式表的链接。花点时间将您的问题减少到最少的示例,然后将其包含在 sn-p 中,这样有人试图帮助您就可以查看所有相关代码,而不必费力地浏览一个巨大的样式表。
标签: html css twitter-bootstrap sass