我想在MAIN id上使用100%高度,但是当我将100%高度放在主id上时,创意类放在主要身上。当在不同的设备中使用像素为主时它看起来不同。
有没有解决办法?
#main {
width: 100%;
height: 675px;
}
.main {
position: fixed;
width: 100%;
height: 100%;
background: url(/images/logo/logo.svg) center no-repeat #ffcc00;
}
.introduction {
position: relative;
display: inline-block;
z-index: 2;
width: 100%;
height: auto;
background: #fcd803;
text-align: center;
padding-bottom: 40px;
}
.introduction h1 {
text-align: center;
text-transform: uppercase;
font-size: 24px;
padding-top: 40px;
}
.introduction span img {
width: 200px;
padding-top: 30px;
}
.introduction div {
text-align: center;
margin-left: 30px;
margin-right: 30px;
margin-top: 30px;
font-size: 15px;
line-height: 21px;
}
.creativity {
position: relative;
z-index: 2;
width: 100%;
height: 320px;
background: #fcd803;
}
.creativity-img {
display: block;
background: url('/images/ariadesk.png');
background-repeat:no-repeat;
background-size:contain;
background-position:bottom;
width: 100%;
height: 320px;
position: absolute;
}
.creativity-img div {
position: relative;
text-align: center;
padding-top: 145px;
}
.creativity-img div h1 {
font-size: 20px;
font-weight: normal;
text-transform: capitalize;
color: white;
border: solid 2px #fff;
display: inline-block;
padding: 10px 50px;
}

<div id="main">
<div class="main">
<div class="logo"><h1>HUR</h1><br><span>studio</span></div>
<div class="nav">
<ul>
<a href="#introduction"><li>introduction</li></a>
<a href="#ourwork"><li>work</li></a>
<a href="#chooseus"><li>service</li></a>
<a href="#client"><li>client</li></a>
<a href="#aboutus"><li>team</li></a>
<a href="#contactus"><li>contact</li></a>
</ul>
</div>
</div>
</div>
<div class="introduction" id="introduction">
<h1>introduction</h1>
<span>
<img src="/images/icon/intro.svg" alt="">
</span>
<div><p>
We are small team of super nerds and talented creatives. Create cutting-edge interfaces and visually stunnig media.<br>
Experts in providing innovative Web Design, Graphic Design, Digital Imaging, Advertising and Branding service</p>
</div>
</div>
<div class="creativity">
<div class="creativity-img"></div>
</div>
&#13;
答案 0 :(得分:1)
答案 1 :(得分:0)
我认为这是因为你的 职位
你的#main与.creativity
处于同一级别如果您希望.main始终位于顶部,只需使用 z-index更改 .creativity :1 AND 您的 .main z-index:2
您永远不会设置 .main 索引,它始终位于底层。
你想要这种情况吗?