Animate CSS | Animation for the Site Header

Here are some ideas that you can use when creating a site header.

You can use them completely, or take some parts and create your own header or banner design.

Pop-up header and description of the site.

Name of the site

Site Description Site Description
Site Description Site Description
Site Description Site Description

Code 1: To see the work of this animation again – refresh the page.

 

Flower

Name of the site

Code 2:

 

Starfall

Name of the site

Code 3:

The change of night and day

Safari
Africa
Egypt

Code 4:

Code 1

<!DOCTYPE html>
<html lang="ru">
    <head>
        <meta charset="utf-8" />
        <title>Animation for the Site Header</title>
<style>
  /* Site header */
.main-header {
  /* Set relative positioning */
  position: relative;
  /* Site header size */
  width: 100%;
  height: 250px;
  overflow: hidden;
  /* Site header background */
  background: steelblue;
  /* Connect the animation */
  animation: main-hed 15s linear;
  }
  /* Name of the site */
.main-title{
  /* We position absolutely, relative to the main-header */
  position: absolute;
  left: -2em;
  right: -2em;
  top: 30%;
  /* Font */
  color: #fff;
  font-family: Monotype Corsiva;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  /* Connect the animation */
  animation: main-titl 15s linear;
}
  /**/
.main-description{
  /* We position absolutely, relative to the main-header */
  position: absolute;
  right: -2em;
  left: -2em;
  top: 50%;
  /* Font */
  color: #fff;
  font-family: Georgia;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-align: center;
  font-style: italic;
  /* Connect the animation */
  animation: main-descript 15s linear;
}

/* Site header background animation */
@keyframes main-hed {
  0% {
    /* Initial Color */
    background: #28014D;
    }
	/* End color */
  100% {
  background: steelblue;
}
}

/* Animating the site name */
@keyframes main-titl{
  0% {
    /* Full transparency */
	opacity: 0;
	transform: scale(0);
  }
  100% {
    /* Full opacity */
	opacity: 1;
	/* Конечный масштаб 1 х 1 */
	transform: scale(1);
  }
}

/* Site description animation */
@keyframes main-descript {
  0% {
    /* Animation start */
    transform: translateY(6em);
	/* Full transparency */
	opacity: 0;
  }
  /* Increase opacity */
  50% {
	opacity: 0.1;
  }
  75% {
	opacity: 0.3;
  }
  100% {
  /* Completing the animation */
    transform: translateY(0);
	/* Full opacity */
	opacity: 1;
  }
}
</style>
</head>
<body>
  <div class="main-header">
    <h1 class="main-title">Name of the siteа</h1>
    <p class="main-description">Site Description Site Description
Site Description Site Description
Site Description Site Description</p> </div> </body> </html>

In this example, note that the site description animation starts outside the main-header.

By the same principle, you can make a pop-up picture, menu

Code 2

The idea of this animation I found on the site css.yoksel.ru.

CSS

.man-header {
  margin: 0;
  overflow: hidden;
  /* Background color in hsl format, radial gradient */
  background: radial-gradient(white 80px, hsl(30, 100%, 60%) 50em);
  position: relative;
  height: 200px;
  width: 600px;
}
/* Positioning in the center*/
.astra {
  position: absolute;
  left: 50%;
  top: 50%;
 /* Remove the list markers */
  list-style: none;
 /* Connect the rotation animation */
  animation: 30s rotate infinite linear;    
}
/* Boundaries with a shadow with the help of pseudo-elements */
.luh,
.luh:before,
.luh:after {
  position: absolute;
  border: 0 solid transparent;
  border-width: 2em 20em;
  width: 0px;
  height: 0px;
  box-shadow: 0 0 2em .5em white;
}
/* Running rays */
.luh {
  left: -20em;
  top: 50%;
  margin-top: -2em;
  transform: rotate(.3deg);
}
/* The length of the rays depends on the position*/
.luh:before,
.luh:after {
  left: -20em;
  top: -2em;
  display: block;
  content: "";
}

.luh:before {
  transform: rotate(60deg);
}
.luh:after {
  transform: rotate(-60deg);
}
/* Offset for each group of rays using a pseudo-class */
.luh:nth-child(2){
  transform: rotate(15deg);
}
.luh:nth-child(3){
  transform: rotate(30deg);
}
.luh:nth-child(4){
  transform: rotate(45deg);
}

@keyframes rotate {
  100% {
    transform: rotate(90deg);
  }
}

.name {
  z-index: 1;
  position: absolute;
  left: 27%;
  top: 20%;
  z-index: 1;
  font: bold 40px 'Monotype Corsiva';
  color: hsl(70, 100%, 70%);
  text-align: center;
 /* Stroking text with shadows */
  text-shadow: -1px -1px #EE8A08,
               -2px -2px #EE8A08,
               -1px 1px #EE8A08,
               -2px 2px #EE8A08,
                1px 1px #EE8A08,
                2px 2px #EE8A08,
                1px -1px #EE8A08,
                2px -2px #EE8A08,
}

HTML

<div class="man-header">
<p class="name">Name of the site</p>
  <ul class="astra">
    <li class="luh"></li>
    <li class="luh"></li>
    <li class="luh"></li>
   <li class="luh"></li>
  </ul>  
  </div>

Code 3

CSS

.space {
	width: 600px;
	height: 200px;
/* Background - a reproduction of a picture */
	background-image: url(images/129a.jpg);
	position: relative;	
}
/* Flashing and falling stars */
.stars1,
.stars2,
.stars3,
.stars4,
.stars5,
.stars6,
.stars7,
.stars8,
.stars9,
.stars10 {
	position: absolute;
	border-radius: 50%/50%;
	background-image: -webkit-radial-gradient(white, black);
	width: 3px;
	height: 3px;
}
/* Position the stars on the top */
.stars1 {
	top: 8%;
	left: 3%;
/* Connect animations with different response time */
	animation: stars1 4s 3s linear infinite;
}
.stars2 {
	top: 3%;
	left: 10%;
	animation: stars2 2s linear infinite;
}
.stars3 {
	top: 15%;
	left: 25%;
	animation: stars3 5s 1s linear infinite;
}
.stars4 {
	top: 12%;
	left: 35%;
	animation: stars4 6s 2s linear infinite;
}
.stars5 {
	top: 23%;
	left: 47%;
	animation: stars5 2.5s 1s linear infinite;
}
.stars6 {
	top: 11%;
	left: 60%;
	animation: stars6 7s linear infinite;
}
.stars7 {
	top: 20%;
	left: 70%;
	animation: stars7 2s 1s linear infinite;
}
.stars8 {
	top: 12%;
	left: 80%;
	animation: stars8 4s linear infinite;
}
.stars9 {
	top: 30%;
	left: 90%;
	animation: stars9 3s 2s linear infinite;
}
.stars10 {
	top: 7%;
	left: 98%;
	animation: stars10 6s linear infinite;
}

.name {
	position: absolute;
	left: 27%;
	top: 20%;
	z-index: 1;
	font: 30px Impact;
	color: hsl(240, 20%, 15%);
	letter-spacing: 4px;
	text-transform: uppercase;
	text-align: center;
 /* Stroking text with shadows */
	text-shadow: -1px -1px hsl(50, 50%, 50%),
                 -2px -2px hsl(50, 50%, 50%),
                 -1px 1px hsl(50, 50%, 50%),
                 -2px 2px hsl(50, 50%, 50%),
                  1px 1px hsl(50, 50%, 50%),
                  2px 2px hsl(50, 50%, 50%),
                  1px -1px hsl(50, 50%, 50%),
                  2px -2px hsl(50, 50%, 50%);
}

/* Flashing */

@keyframes stars2 {
	0% {
		opacity: 1;
	}
	100%{
		opacity: 0;
	}
}
@keyframes stars5 {
	0% {
		opacity: 1;
	}
	100%{
		opacity: 0;
	}
}
@keyframes stars7 {
	0% {
		opacity: 1;
	}
	100%{
		opacity: 0;
	}
}
@keyframes stars9 {
	0% {
		opacity: 1;
	}
	100%{
		opacity: 0;
	}
}

/* Falling */

@keyframes stars1 {
	0% {
		width: 1px;
	}
	7% {
		width: 6px;
		opacity: 1;
		transform: translate(150px, 150px);	 
	}
	8% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes stars3 {
	0% {
		width: 3px;
	}
	12% {
		width: 10px;
		opacity: 1;
		transform: translate(-200px, 200px);	 
	}
	13% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes stars4 {
	0% {
		width: 3px;
	}
	10% {
		width: 10px;
		opacity: 1;
		transform: translate(200px, 300px);	 
	}
	11% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes stars6 {
	0% {
		width: 3px;
	}
	10% {
		width: 10px;
		opacity: 1;
		transform: translate(-400px, 300px);	 
	}
	11% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes stars8 {
	0% {
		width: 3px;
	}
	10% {
		width: 10px;
		opacity: 1;
		transform: translate(-300px, 300px);	 
	}
	11% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes stars10 {
	0% {
		width: 3px;
	}
	10% {
		width: 10px;
		opacity: 1;
		transform: translate(-600px, 200px);	 
	}
	11% {
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}

HTML

<div class="space">
	<p class="name">Name of the site</p>
		<div class="stars1"></div>
		<div class="stars2"></div>
		<div class="stars3"></div>
		<div class="stars4"></div>
		<div class="stars5"></div>
		<div class="stars6"></div>
		<div class="stars7"></div>
		<div class="stars8"></div>
		<div class="stars9"></div>
		<div class="stars10"></div>
</div>

Code 4

CSS

.panorama{
	width: 900px;
	height: 300px;
	left: 0;
	top: 0;
	overflow: hidden;
	background: #4FC3F7;
	position: relative;
	animation: main-layout 40s linear infinite;
}
.ground {		/* Strip of the Earth */
	display: block;
	position: absolute;
	width: 100vw;
	height: 40px;
	left: 0;
	bottom: 0;
	background: #F4511E;
	z-index: 10;
}
.sun {		/* The sun */
	position: absolute;
	width: 150px;
	height: 150px;
	top: 250px;
	left: 750px;
	background: #FFF;
	border-radius: 50%;
	z-index: 1;
	animation: main-sun 40s linear infinite;
}
.selen{		/* Moon */
    position: absolute;
	top: 0;
	left: 800px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: #fff;
	animation: main-selen 40s linear infinite;
}
.selen::before {	
    content: "";
	position: absolute;
	left: -5px;
	top: -5px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: #030104;
}
.safari,
.africa,
.egipet {		/* Words on the pyramids */
	font-family: Impact;
	position: absolute;
	color: #fff;
	transform: rotate(40deg);
	z-index: 5;	
	text-shadow: 1px 1px #050505,
				 2px 2px #050505,
				 3px 3px #050505,
				 4px 4px #050505;
}
.safari{
	top: 150px;
	left: 310px;
	font-size: 35px;
	letter-spacing: 0.4em;
	z-index: 5;
}
.africa {
	top: 190px;
	left: 630px;
	font-size: 30px;
	letter-spacing: 0.3em;
	z-index: 5;
}
.egipet {
	top: 205px;
	left: 105px;
	font-size: 22px;
	letter-spacing: 0.3em;
	z-index: 5;
}
.shadow {		/* Shadows of the pyramids */
	display: block;
	position: absolute;
	width: 100%;
	height: 100%;
	top: 8%;
	left: -50%;
	background: #333;
	transform: rotate(30deg);
}
.pyramid {		/* The blocks of the pyramids */
	display: block;
	position: absolute;
	width: 950px;
	height: 300px;
	left: 50%;
	bottom: 10px;
	transform: translate(-50%, 0px);
	z-index: 2;
}
.pr1,
.pr2,
.pr3 {		/* The edges of the pyramids */
	display: block;
	position: absolute;
	background: #F4511E;
	overflow: hidden;
	transform: rotate(45deg) translate(50%, 50%);
}
.pr1 {
	width: 500px;
	height: 500px;
	bottom: 30px;
	left: 20%;
	z-index: 2;
}
.pr2 {
	width: 400px;
	height: 400px;
	bottom: 0px;
	right: 20px;
	z-index: 3;
}
.pr3 {
	width: 300px;
	height: 300px;
	bottom: 0;
	left: 30px;
	z-index: 4;
}
/* Animations */
@keyframes main-sun{
	0% {
	transform: translateY(-10px);
	background: #FF5F00;
	}
	25%{
	transform: translateY(-260px);
	background: #fff;
	width:80px;
	height:80px;
	}
	35%{
	transform: translateY(-260px);
	}
	40% {
	background: #fff;
	}
	60%{
	transform: translateY(10px);
	width:150px;
	height:150px;	
	background: #FF5F00;
	}
}
@keyframes main-layout{
	0% {
	  background: #333333;
	}
	10%{
		 background: #4FC3F7;
	}
	40%{
	background: #4FC3F7;	
	}
	50% {
	  background: #333333;	
	}
	55% {
	  background-image: url(images/129a.jpg);	
	}
	100% {
	  background-image: url(images/129a.jpg);
	}
}
@keyframes main-selen {
	0% {
	opacity: 0;	
	}
	55% {
	opacity: 0;	
	}
	60% {
	opacity: 1;	
	}
	80% {
	opacity: 1;	
	}
	100% {
	opacity: 0;	
	}
}

HTML

<div class="panorama">
<div class="safari">Safari</div>
<div class="africa">Africa</div>
<div class="egipet">Egypt</div>
  <div class="night"></div>
  <div class="sun"></div>
  <div class="selen"></div>
 <div class="pyramid">
    <div class="pr1"><div class="shadow"></div></div>
    <div class="pr2"><div class="shadow"></div></div>
    <div class="pr3"><div class="shadow"></div></div>
  </div>
  <div class="ground"></div>
</div>

I wish you creative success.

This entry was posted in Free Scripts. Bookmark the permalink.
А так же:

Leave a Reply

Your email address will not be published. Required fields are marked *