FooterTutorials

How to create a CSS Gooey footer

How to create a CSS Gooey footer

Before We Start

Every developer needs clean and modern elements to develop their websites, It contains pictures and a user interface element within a website. The most important one and the first section that the user sees when the user enters a website. How to create a CSS Gooey footer

So if you are a person who wishes to develop a website, you have to know how to create that properly.

We are here to solve your problem. In this article we discuss how to create these elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.

<footer>
  <div class="gooey-animations"></div>
  <h1>This footer was made by <span>W3SchoolWeb</span></h1>
</footer>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <defs>
    <filter id="goo">
      <feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blur" />
      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 15 -7" result="goo" />
      <feBlend in="SourceGraphic" in2="goo" />
  	</filter>
  </defs>
</svg>


<svg viewbox="0 0 1440 328" width="100vw">
    <defs>
        <clipPath id="wave" clipPathUnits="objectBoundingBox" transform="scale(0.00069444444, 0.00304878048)">
            <path d="M504.452 27.7002C163.193 -42.9551 25.9595 38.071 0 87.4161V328H1440V27.7002C1270.34 57.14 845.711 98.3556 504.452 27.7002Z"/>
        </clipPath>
    </defs>
</svg>

Step 2 – Add CSS

We use some external CSS link to this code. No need to worry about this, copy and paste below code between <style></style> tag.

<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,500&display=swap">
</head>

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #2F3B45;
}

svg {
  width: 100vw;
}

footer {
  width: 100vw;
  bottom: 0;
  position: absolute;
  left: 0;
  display: flex;
  align-items: flex-end;
  padding-bottom: 3rem;
  justify-content: center;
  overflow: hidden;
  position: absolute;
  width: 100vw;
  height: 400px;
  bottom: 0;
  filter: url("#goo");
}
footer h1 {
  z-index: 2;
  color: white;
  font-family: "Ubuntu", sans-serif;
  font-weight: lighter;
  font-size: calc(2vmin + 8px);
}
footer h1 span {
  font-weight: bold;
  color: #FFA036;
  text-shadow: 0 0 15px rgba(255, 160, 54, 0.4);
}
footer::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 225px;
  clip-path: url("#wave");
  background-color: #28323B;
}
@media only screen and (max-width: 700px) {
  footer::after {
    clip-path: none;
    height: 150px;
  }
}
footer .ball {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #28323B;
  position: absolute;
  animation: up 5s cubic-bezier(0.18, 0.89, 0.32, 1.28) infinite;
}
@media only screen and (max-width: 700px) {
  footer .ball {
    animation: up-small 5s cubic-bezier(0.18, 0.89, 0.32, 1.28) infinite;
  }
}

@keyframes up {
  0% {
    bottom: 0px;
    width: 100px;
    height: 100px;
  }
  50% {
    bottom: 200px;
  }
  100% {
    bottom: 0px;
    width: 0px;
    height: 0px;
  }
}
@keyframes up-small {
  0% {
    bottom: 0px;
    width: 100px;
    height: 100px;
  }
  50% {
    bottom: 150px;
  }
  100% {
    bottom: 0px;
    width: 0px;
    height: 0px;
  }
}

</style>

Step 3 – Add JavaScript

We use some external JavaScript link to this code. No need to worry about this, copy and paste below code between <head></head> tag.

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>

And also copy and paste below JavaScript code between <script></script> tag.

<script>
function generateBalls() {
  for (var i = 0; i < Math.floor(window.innerWidth / 20); i++) {
    $(".gooey-animations").append(`
    <div class="ball"></div>
  `);
    var colors = ["#28323B", "#FFA036"];
    $(".ball")
      .eq(i)
      .css({
        bottom: "0px",
        left: Math.random() * window.innerWidth - 100,
        "animation-delay": Math.random() * 5 + "s",
        transform: "translateY(" + Math.random() * 10 + "px)",
        "background-color": colors[i % 2]
      });
  }
}
generateBalls();

window.addEventListener("resize", function (e) {
  $(".gooey-animations .ball").remove();
  generateBalls();
});

</script>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Your Output

How to create a CSS Gooey footer

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

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

Back to top button