Development

Make text grow on page load with CSS keyframes

Using CSS keyframe animations on page load can add something extra to your design. Whether it be animating a border, a background change or section grow, using keyframes to change elements with just CSS can be a nice touch.

Here is how to grow text on page load, i am using a h1 element but you can use any typography element.

You can see in the CSS below the animation takes 3 seconds to make the font size 0 to 4rem. There are only 2 keyframes… 0% (the start) and 100% (end).

CSS:

.header-grow {
  animation: growth 3s;
  animation-fill-mode: backwards;
  font-size: 4rem;
}

@keyframes growth {
  0% {
    font-size: 0;
  }
  100% {
    font-size: 4rem;
  }
}

The h1 element:

<h1 class="header-grow">Some heading text</h1>

Gives this result

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago