Assalamu'alaikum wr wb
kali ini saya akan share bagaimana Cara buat parallax di css tanpa javascript,
berikut ini syntaxnya.
<style type="text/css">
/* Tiny reset thingy */
body,html{margin:0;padding:0;}
.wrapper {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
perspective: 2px;
}
.section {
position: relative;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: white;
text-shadow: 0 0 5px #000;
}
.parallax::after {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform: translateZ(-1px) scale(1.5);
background-size: 100%;
z-index: -1;
}
.static {
background: red;
}
.bg1::after {
background-image: url('https://placekitten.com/g/900/700');
}
.bg2::after {
background-image: url('https://placekitten.com/g/800/600');
}
</style>
<main class="wrapper">
<section class="section parallax bg1">
<h1>Such Adorableness</hi>
</section>
<section class="section static">
<h1>Boring</h1>
</section>
<section class="section parallax bg2">
<h1>SO FWUFFY AWWW</hi>
</section>
</main>
Semoga bermanfaat.
https://pangeran-it.blogspot.co.id
Cara buat parallax di css tanpa javascript
Reviewed by Syawaluddin Amin, S.Kom
on
Oktober 13, 2017
Rating:
Tidak ada komentar: