Water Wave Animation Using HTML, CSS

 Hello! Welcome to CodeXimo. 

You are looking for Today i Creating Water Wave Animation Using HTML, CSS then this post is just for you.

HTML Basic

The HTML document begins with the <!DOCTYPE html> declaration, specifying the document type. The <html> tag encloses the content and metadata of the page, with the `lang` attribute set to "en" for English. Inside the <head> section, the <meta charset="UTF-8"> tag sets the character encoding to UTF-8, ensuring proper display of text. The <meta name="viewport" content="width=device-width, initial-scale=1.0"> tag ensures the page is responsive by setting the viewport to match the device's width. The <title>Water Wave</title> tag sets the title of the page, which appears in the browser tab. The <link rel="stylesheet" href="style.css"> tag links an external CSS file named "style.css" for styling. In the <body>, a centered heading with the text "Water Wave" is created using <center><h1>Water Wave</h1></center>. Below the heading, a `div` with the class "circle" contains another `div` with the class "wave", representing the animated wave inside the circle.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Water Wave</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <center><h1>Water Wave</h1></center>
<div class="circle">
    <div class="wave">
    </div>   
</div>
</body>
</html>

CSS Styling

The CSS code starts by resetting the default margin and padding of the body element to 0 and setting the background color to white with background: #ffffff;. The `h1` heading is styled with a blue color using `color: #0000ff;`. The .circle class positions the circle element in the center of the viewport using position: absolute;`, `top: 50%;`, `left: 50%;`, and `transform: translate(-50%, -50%) scale(1.6);. The circle has a width and height of 150 pixels, a white border of 5 pixels, and a blue box shadow. The border radius is set to 50% to create a circular shape, and the overflow: hidden; property ensures the wave remains inside the circle.

The .wave class positions the wave inside the circle and gives it a blue background with background: #4973ff;. The wave also has a circular shape due to the border-radius: 50%;` property. The `box-shadow: inset 0 0 50px rgba(0,0,0,0,5); property adds an inset shadow to the wave for a more realistic effect.

The ::before and ::after pseudo-elements are used to create two overlapping waves with different border radii and semi-transparent white backgrounds. They are positioned absolutely within the .wave element and animated using the @keyframes animate rule. The animation rotates the waves continuously for a dynamic water wave effect.

body{
  margin: 0;
  padding: 0;
  background: #ffffff;
}

h1 {
  color: #0000ff;
}

.circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.6);
  width: 150px;
  height: 150px;
  border: 5px solid #fff;
  box-shadow: 0 0 0 5px #4973ff;
  border-radius: 50%;
  overflow: hidden;
}
.wave {
  position: relative;
  width: 100%;
  height: 100%;
  background: #4973ff;
  border-radius: 50%;
  box-shadow: inset 0 0 50px rgba(0,0,0,0,5);
}

.wave::before, .wave::after {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: 0;
  left: 50%;
  transform: translate(-50%, -75%);
  background: #000;
}

.wave::before {
  border-radius: 45%;
  background: rgba(255,255,255, .5);
  animation: animate 10s linear infinite;
}

.wave::after{
  border-radius: 40%;
  background: rgba(255,255,255, .5);
  animation: animate 10s linear infinite;
}
@keyframes animate {
  0% {
    transform: translate(-50%, -70%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -80%) rotate(360deg);
  }
}
Conclusion 

Congratulations! You've embarked on a journey to create a Water Wave Animation Using HTML, CSS. Illuminate your web design skills and captivate your audience with this enchanting tutorial.

About the Author

Student | Developer | Blogger

Post a Comment

🌟 Attention, Valued Community Members! 🌟

We're delighted to have you engage in our vibrant discussions. To ensure a respectful and inclusive environment for everyone, we kindly request your cooperation with the following guidelines:

1. Respect Privacy: Please refrain from sharing sensitive or private information in your comments.

2. Spread Positivity: We uphold a zero-tolerance policy towards hate speech or abusive language. Let's keep our conversations respectful and friendly.

3. Language of Choice: Feel free to express yourself in either English or Hindi. These two languages will help us maintain clear and coherent discussions.

4. Respect Diversity: To foster an inclusive atmosphere, we kindly request that you avoid discussing religious matters in your comments.

Remember, your contributions are valued, and we appreciate your commitment to making our community a welcoming place for everyone. Let's continue to learn and grow together through constructive and respectful discussions.

Thank you for being a part of our vibrant community! 🌟
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.