Ken Burns effect is an animation of any image by panning and zooming. It is achieved in web design with some simple CSS code. The fundamental idea of this Ken Burns effect was invented by a US-based documentarian named Ken Burns. Nowadays, Some web designers use this technique in their web design strategy. Using this Ken Burns photo effect, we will get an excellent pan and zoom effect of the image we will use as a homepage background.
Today we will create a Simple Ken Burns effect using CSS Keyframes Animation on a simple-looking homepage. Earlier we shared a blog post on Responsive Team Accordion using Bootstrap. We will use plain HTML and CSS to make the simple Ken Burns effects. To summarize we will use CSS Keyframes animation in this snippet.
Video Tutorial:
You may also like:
We are moving on to CSS code. First, we discarded the document's default padding and margin by giving the body a margin and padding of 0. We used Lato as a font family for the project. After that, we gave the Nav element a position fixed property and also gave it a z-index value of 1. We did this because we wanted the nav to be at the top of the banner. we have given a custom 1170px width to the nav element and tried to make it in the middle by giving it top and left values. Then we styled the logo text and placed that to the right by giving it a float left the property.
Then comes the menu, which we placed to the right by giving it float right value. Then we did some styling for the anchor tags inside the "menu" class. For the banner image, I provided a width of 100% and a height of 100vh to make the full width of the viewport. Then I have given it overflow hidden and relative position value as well. I set an animation for the image with the name "animate" and gave it a 40s animation duration and an animation timing function. I placed the banner text element slightly left of the homepage but gave it an absolute position, top, and left value. After that, I did some basic styling for all the elements inside the banner-text class. For the CSS keyframes animation, I set the CSS in a way so that at the beginning, the image will start scaling bigger for the bottom right origin, and at 100%, the image will finish transforming from scale 1 to 1.3.
Ken Burns effect using CSS Animation [ Source Code ]:
To create this web layout with Ken Burns effects, you can copy the following HTML and CSS code and paste it into your project files, and save them. You can also download the code from the download button below this blog post.
HTML:
CSS:
Post a Comment
Please do not enter any spam link in the comment box.