Saturday 20 February 2021

Loading Animation using HTML CSS

Loading Animation using HTML CSS

Download : Code

index.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css" type="text/css">
    <title>Loading Animation in HTML</title>
  </head>
  <body>
    <div class="main">
      <p class="text" id="text">0%</p>
      <div class="line" id="line">
      </div>
    </div>
    <script type="text/javascript">
      const op = setInterval(incNum, 20);
      function incNum() {
        const text = document.getElementById("text");
        const line = document.getElementById("line");

        let a = window.getComputedStyle(line,':before').getPropertyValue('width');
        a=Math.floor((parseInt(a)/10)*2);
        text.innerHTML = a + '%';
        console.log(a);
        if(a==100){
          clearInterval(op);
        }
      }
    </script>
  </body>
</html>

Style.css

@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');
*{
  margin: 0;
  padding: 0;
}
.main{
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.line{
  width: 500px;
  height: 12px;
  background-color: rgb(243, 243, 243);
  border-radius: 50px;
  position: relative;
}
.line::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #8E2DE2;
  border-radius: 50px;
  background: linear-gradient(to right, #4A00E0, #8E2DE2);
  animation: anim 2s;
}
@keyframes anim {
  0%{
    width: 0%;
  }
  20%{
    width: 5%;
  }
  50%{
    width: 25%;
  }
  60%{
    width: 35%;
  }
  100%{
    width: 100%;
  }
}
p{
  font-size: 5rem;
  font-family: 'Lobster',cursive;
  color: rgba(51, 51, 51);
  margin-bottom: 15px;
}


Download Code from Git 
Download - Code


Thursday 18 February 2021

Navigation Menu with Water Hover Effect

Navigation Menu with Water Hover Effect


Download : Code

index.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css" type="text/css">
    <title>Navigation Menu Water Effect Using HTML & CSS</title>
  </head>
  <body>
    <div class="menu">
      <a href="#">Home</a>
      <a href="#">Service</a>
      <a href="#">About</a>
      <a href="#">Contact Us</a>
    </div>
  </body>
</html>

Style.css

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body{
  height: 100vh;
  background: linear-gradient(to right,#3c1053,#ad5389);
}
.menu{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}
.menu a{
  color: rgb(233, 233, 233);
  text-decoration: none;
  font-size: 1.5rem;
  padding: 15px 30px;
  margin: 20px;
  background: rgba(255, 255, 255, 0.055);
  position: relative;
  transition: all .4s;
}
.menu a:hover{
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.24);
}
.menu a::before{
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: #845ec2;
  z-index: -1;
  transition: all .4s;
}
.menu a:hover::before{
  height: 50%;
}



Download Code from Git 
Download - Code

Donate