在代码段中有一个向下箭头:#arrowDown
。我正在努力让这个箭头置于标题和副标题下的中心位置。我使用班级.total-center
将标题和副标题居中,然后将箭头的换行放在这个居中的div中。
有人看到为什么#arrowDown
不像其他项目那样垂直和水平居中?
.total-center {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100%;
}
#solMain {
width: 100%;
height: 100vh;
background: red;
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
}
#solMainTitle, #solMainDesc {
color: #FFF;
text-shadow: 2px 2px #242424;
line-height: 1.5em;
}
#solMainTitle {
font-family: 'Muli', sans-serif;
font-size: 1.7rem;
font-weight: 800;
text-transform: uppercase;
margin-bottom: 50px;
}
#solMainDesc {
font-family: 'Nunito', sans-serif;
letter-spacing: .2rem;
font-size: 1rem;
}
#arrowDownWrap {
cursor: pointer;
width: 25px;
height: 25px;
position: relative;
text-align: center;
}
#arrowDownWrapInner {
bottom: 40px;
position: relative;
}
#arrowDown, #arrowDown2 {
border: solid #FFF;
border-width: 0 3px 3px 0;
width: 25px;
height: 25px;
display: block;
padding: 3px;
-webkit-transform: rotate(45deg);transform: rotate(45deg);
-webkit-transition: all 0.5s;transition: all 0.5s;
position: absolute;
top: 0;
left: 0;
}
#arrowDownWrap:hover #arrowDown2 {
-webkit-transform: translate(0,40px) rotate(45deg) ;transform: translate(0,40px) rotate(45deg);
-webkit-transition: all 0.5s;transition: all 0.5s;
}
<section id="solMain">
<div class="total-center">
<h1 id="solMainTitle">Title Text</h1>
<span id="solMainDesc">Subtitle text</span>
<div id="arrowDownWrap">
<div id="arrowDownWrapInner">
<i id="arrowDown"></i>
<i id="arrowDown2"></i>
</div>
</div>
</div>
</section>