html - Vertically Sliding CSS Background Image -
I saw
The background image scroll is vertically giving a meaning that it is larger than the viewport. I tried to play with CSS with no luck.
HTML
& lt; Div class = "out" & gt; & Lt; Div class = "inner" & gt; Hello & lt; / Div & gt; & Lt; / Div & gt;
css
@keyframes scrollbugrigrix {0% {Transform: Youtube (Translator); } 100% {Conversions: Translator Y (-330px); }}. Manufacturer {Animation: 35S linear 0s general front 1 scrollbugrigrix; Background color: red; Status: Completed; Clip: Rect (0 pixels, 50px, 50px, 0px); Width: 200px; } .out {height: 200px; }
pseudo-element sliding background
one or two background pseudo & lt; Body & gt; Elements of
are the position: fixed
with height and width.
Use this to show the elements above the background:
element-to-show-above {status: relative; Z-index: 1; }
For pages with many content, it will be able to apply the above properties in a cover that contains all your elements.
Two examples
"Show code snippet" and run it to see the demo.
# 1 - A slow infection on top and stop
-
The height of a pseudo element is the height and width of the 200% viewport
-
>
-webkit -
prefix for the transformed property.body {margin: 0; Body: {content: ''; Display area; Webkit-Animation: 80 SBG Linear Forward; Animation: 80s BG Linear Forward; Background: URL (http://i.stack.imgur.com/zawJr.jpg) no-repeat; Background-shaped: 100% 100%; Status: fixed; Height: 300%; Width: 200%; Top: 0; Left: 0; } @ -webkit-keyframe bg {0% {-webkit-transform: translateY (0); Conversion: Translator Y (0); } 100% {-webkit-transform: translation Y (-50%); Conversions: Translator Y (-50%); }} @ Keyframe bg {0% {-webkit-transform: translateY (0); Conversion: Translator Y (0); } 100% {-webkit-transform: translation Y (-50%); Conversions: Translator Y (-50%); }}
# 2 - never ending background slideshow
-
starting from the number one Does 0 slides and -100%
-
The number starts with two 100% and slides on 0.
Together they create a constant speed illusion with the need for any additional HTML!
-
Note:
Comments
Post a Comment