我想在使用滚动效果的同时垂直对齐我的文本(这是多行)。我尝试将vertical-align: middle;
放入我的代码中,但它不起作用。垂直对齐滚动效果
我的CSS代码
.splash-container {
background: #ffffff;
z-index: 1;
overflow: hidden;
width: 100%;
height: 100%;
top: 0;
left: 0;
position: fixed;
top: 100px; left: 0; bottom: 0; right: 0;
/*margin-top: 20%;*/
}
.splash {
width: 80%;
height: 50%;
margin: auto;
text-align: center;
}
.splash-head {
font-size: 20px;
font-weight: 900;
font-family: "Lucida Sans", Helvetica, sans-serif;
color: #333;
border: 3px solid #333;
padding: 1em 1.6em;
border-radius: 5px;
line-height: 1em;
}
.splash-subhead {
font-family: "Lucida Sans", Helvetica, sans-serif;
color: #333;
letter-spacing: 0.05em;
opacity: 0.8;
}
.content-wrapper {
position: absolute;
top: 100%;
z-index: 2;
background: #f2f2f2;
}
#description {
padding: 50px;
}
下面是HTML:
<div class="splash-container">
<div class="splash">
<h1 class="splash-head">Title</h1>
<p class="splash-subhead">
Text
</p>
<p><a href="..." >Button</a></p>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div id="description">(Text that will scroll over)</div><hr>
</div>
</div>
我想防溅容器具有垂直对齐,使所有的文字在它是在中间的屏幕。我试着用vertical-align: middle
这样做,但没有奏效。
任何想法?谢谢。
你能详细一点?你的问题不是很清楚。你究竟想达到什么目的? – Lansana
我想垂直对齐屏幕中间的splash-container div(即标题,文本和按钮)中的所有文本 – user5139637