css 使用关键帧的简单CSS标头推子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 使用关键帧的简单CSS标头推子相关的知识,希望对你有一定的参考价值。
<header>
<div class="panel">
<span style="display: inline-block; vertical-align: middle; height:100vh;"></span>
<span style="display: inline-block; vertical-align: middle; ">
<p class="title">Weshule Educational Services</p>
<p class="sub-title"><a href="http://webshule.com" target="_blank">The N-Line Project</a></p>
</div>
<i class="ion-chevron-down">scroll down</i>
</header>
<section>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.
</p><p>
Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia.
</p><p>
Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi.
</p><p>
Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis.
</p><p>
Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></section>
Simple CSS header fader using keyframes
---------------------------------------
This is a simple header fader made with CSS only by using keyframes animation.
It's sometimes a bit choppy though, no idea how to solve that.
A [Pen](https://codepen.io/Pentest/pen/YxPzBK) by [Oasis Innocent](http://codepen.io/Pentest) on [CodePen](http://codepen.io/).
[License](https://codepen.io/Pentest/pen/YxPzBK/license).
@import url(https://fonts.googleapis.com/css?family=Roboto|Lato|Pacifico|Courgette|Playball|Cookie|Damion);
html, body {
background-position: top center;
background-attachment: fixed;
background-color: #fff;
color: #000;
font-family: 'Open Sans', sans-serif;
font-size: 13px;
overflow-x: hidden;
margin: 0px;
}
header {
text-align:center;
width:100%;
position:relative;
height:100vh;
animation: bgimage 10s ease-in-out infinite alternate;
}
@keyframes bgimage {
0% {
background: url("https://static.pexels.com/photos/1702/bow-tie-businessman-fashion-man-large.jpg") center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
25% {
background: url("https://static.pexels.com/photos/20967/pexels-photo-large.jpg") center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
50% {
background: url("https://static.pexels.com/photos/4097/city-cars-traffic-lights-large.jpeg") center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
75% {
background: url("https://static.pexels.com/photos/51415/pexels-photo-51415-large.jpeg") center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
100% {
background: url("https://static.pexels.com/photos/2318/vintage-technology-keyboard-old-large.jpg") center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
}
.panel {
background: rgba(255,255,255,0.4);
position: relative;
border: 1px solid rgba(255,255,255,0.1);
width: 100%;
height: 100%;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: table;
}
.panel span p {
color: rgba(27, 27, 27, 0.5);
padding: 0px 150px;
background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.5) 25%, rgba(255,255,255,0.5) 75%, rgba(255,255,255,0) 100%);
background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,0.5) 25%,rgba(255,255,255,0.5) 75%,rgba(255,255,255,0) 100%);
background: linear-gradient(to right, rgba(255,255,255,0) 0%,rgba(255,255,255,0.5) 25%,rgba(255,255,255,0.5) 75%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=1 );
}
a {
text-decoration: none;
color: rgba(27, 27, 27, 0.5);
}
.panel span p.title {
font-family: 'Damion', sans-serif;
font-size: 40px;
letter-spacing: 9px;
}
.panel span p.sub-title {
text-transform: uppercase;
font-size: 10px;
padding: 10px 150px;
letter-spacing: 4px;
font-weight: bolder;
}
i.ion-chevron-down {
color: rgba(27, 27, 27, 0.5);
font-size: 16px;
bottom: 0px;
position: absolute;
left: 0px;
right: 0px;
font-style: normal;
font-variant: small-caps;
font-weight: bolder;
}
.ion-chevron-down:before {
display: block !important;
margin: -36px;
}
i.ion-chevron-down {
animation: bouncetext .6s cubic-bezier(0.165, 0.840, 0.440, 1.000) infinite alternate;
animation-delay: 0;
}
@keyframes bouncetext {
0%{transform: translateY(0px);}
100% {transform: translateY(-25px);}
}
section {
height: auto;
width: 75%;
margin: 0 auto;
background: rgba(34, 34, 34, 0.07);
border: 1px solid #DFDFDF;
}
section p {
font-size: 15px;
padding: 20px 50px;
}
以上是关于css 使用关键帧的简单CSS标头推子的主要内容,如果未能解决你的问题,请参考以下文章
用于动画关键帧的 Sass Mixin,包括多个阶段和变换属性
markdown 一个简单的Sass函数,用于基于帧的CSS动画