Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.

Hello, welcome. Today we’ll see, how we can easily create an awesome wavy button hover effect with pure. We’ll see how we can create pure css wavy curve design.

To see demo or you want full coding tutorial video. You can watch the tutorial below.


This content originally appeared on DEV Community and was authored by Modern Web

Hello, welcome. Today we'll see, how we can easily create an awesome wavy button hover effect with pure. We'll see how we can create pure css wavy curve design.

To see demo or you want full coding tutorial video. You can watch the tutorial below.

Video Tutorial

So, without wasting more time let's see how to code this.

Code

First, for this project we have 2 files index.html and style.css. Start by writing basic HTML structure. After that, create a button.

index.html

<button class="btn">
    button
</button
Output

Blog -1
Now, center this button and give dark background to body.

Style.css
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0e0e0e;
}
Output

blog-2

After this style button little bit.

Style.css
.btn{
    position: relative;
    width: 200px;
    height: 60px;
    font-size: 30px;
    text-transform: capitalize;
    font-family: 'roboto', sans-serif;
    letter-spacing: 2px;
    background-color: transparent;
    color: #fff;
    border: none;
    outline: none;
    overflow: hidden;
    cursor: pointer;
}

Make sure you give overflow: hidden;.

Output

blog -3

Now inside index.html inside our button element, create span element with class wave. Like this.

index.html
<button class="btn">
    <span class="wave"><p>aaaaaaaaaaaaaaaaaaaaaa</p></span>
    button
</button>

You can type anything inside p tag but make sure to type long text.

Give some style to it.

stlye.css
.wave{
    position: absolute;
    background: rgb(255, 46, 46);
    width: 100%;
    height: 80%;
    left: 0;
    bottom: 0%;
}
Output

blog -4

Well, this doesn't look like our effect. To make that effect, Style the p element also.

Style.css
.wave{
    // previous styles.
    transform: rotate(180deg);
}
.wave p{
    font-size: 60px;
    color: transparent;
    text-decoration-style: wavy;
    text-decoration-color: rgb(255, 46, 46);
    text-decoration-line: underline;
}
Output

blog-5

Now, you can see we have something on top. Change span element's line-height property little bit.

.wave{
     // previous styles.
     line-height: 40px;
}
Output

blog-6

We have wave now.If you didn't notice we created this wavy line with these properties.

    text-decoration-style: wavy;
    text-decoration-color: rgb(255, 46, 46);
    text-decoration-line: underline;

As you can see on the output we have little gap between the wave. So to fix that create another span element with same class.

index.html
<button class="btn">
    <span class="wave"><p>aaaaaaaaaaaaaaaaaaaaaa</p></span>
    <span class="wave"><p>aaaaaaaaaaaaaaaaaaaaaa</p></span>
    button
</button>

And change second wave's line height.

style.css
.wave:nth-child(2){
    line-height: 30px;
}
Output

blog-7

To make these span elements behind the button. Use z-index. And give transition also.

style.css
.wave{
     // previous styles.
     transition: bottom 1s;
     z-index: -1;
}
Output

blog-8

Now make that wave animation.

style.css
.wave p{
    // previous styles
    animation: wave 1s linear infinite;
}

@keyframes wave{
    100%{
        margin-left: -50%;
    }
}
Output

Untitled design (2)

Now we are almost done just change wave element's bottom value to -100% and set it to 0 on hover.

style.css
.wave{
    bottom: -100%; // set it negative 100%
}
.btn:hover .wave{
    bottom: 0;
}
Output

Untitled design (1)

We are done.

So, that's it. I hope you understood each and everything. If you have doubt or I missed some thing let me know in the comments.

Articles you may found Useful

  1. CSS Positions
  2. CSS Media Query
  3. CSS flex box
  4. Infinte CSS loader
  5. Youtube Clone : Youtube API

If you like, you can subscribe my youtube channel. I create awesome web contents. Subscribe

Thanks For reading.


This content originally appeared on DEV Community and was authored by Modern Web


Print Share Comment Cite Upload Translate Updates
APA

Modern Web | Sciencx (2021-08-01T10:42:42+00:00) Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.. Retrieved from https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/

MLA
" » Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.." Modern Web | Sciencx - Sunday August 1, 2021, https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/
HARVARD
Modern Web | Sciencx Sunday August 1, 2021 » Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.., viewed ,<https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/>
VANCOUVER
Modern Web | Sciencx - » Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/
CHICAGO
" » Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.." Modern Web | Sciencx - Accessed . https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/
IEEE
" » Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design.." Modern Web | Sciencx [Online]. Available: https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/. [Accessed: ]
rf:citation
» Create Awesome Wavy Button Hover Effect. Pure CSS Wavy Design. | Modern Web | Sciencx | https://www.scien.cx/2021/08/01/create-awesome-wavy-button-hover-effect-pure-css-wavy-design/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.