2024 Modern Button Hover Effects Using HTML and CSS

2024 Modern Button Hover Effects Using HTML and CSS


Welcome to my website U-GINE MEDIA. In this website I teach tutorials and share source code on some programming (HTML, CSS & JavaScript) tutorials. 

Before we get started, do well to subscribe to my channel to never miss out on any update that I post every single day.

In this tutorial topic "2024 Modern Button Hover Effects Using HTML and CSS", we will learn how to create it following these simple easy steps.

Share this to your programmer friends. If y'all learnt something today, make sure to let me in the comments. 

If interested in watching the video before running the code below, you can click the play button to get started.


Code Begins

  1. First, create a folder with any name you like. Then, make the necessary files inside it.
  2. Create a file called index.html to serve as the main file.
  3. Create a file called style.css for the CSS code.
  4. Finally, go to Font Awesome and embed their cdnjs library link to your main file

To start, add the following HTML codes to your index.html file. These codes include essential HTML markup with different semantic tags, such as div, form, input, button, image, etc., to build the website layout. 


<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="index.css">
    <link rel="stylesheet" href="font-awesome.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2023 Modern Button Using HTML and CSS</title>
</head>
<body>

    <div class="container">
        <ul>
            <li style="--clr: #4267b2">
            <a href="#">
                <i class="fa fa-facebook"></i>
            </a>
            </li>
            <li style="--clr: #ff0000">
                <a href="#">
                    <i class="fa fa-youtube-play"></i>
                </a>
            </li>
            <li style="--clr: #1da1f2">
                <a href="#">
                    <i class="fa fa-twitter"></i>
                </a>
            </li>
            <li style="--clr: #e1306c">
                <a href="#">
                    <i class="fa fa-instagram"></i>
                </a>
            </li>
            <li style="--clr: #25d366">
                <a href="#">
                    <i class="fa fa-whatsapp"></i>
                </a>
            </li>
        </ul>
    </div>



    <div class="year">
        <ul>
            <li style="--clr: #25d366">
            <a href="#">2</a>
            </li>
            <li style="--clr: #e1306c">
                <a href="#">0</a>
                </li>
                <li style="--clr: #ff0000">
            <a href="#">2</a>
            </li>
            <li style="--clr: #1da1f2">
            <a href="#">4</a>
            </li>
        </ul>
    </div>


</body>
</html>

Next, add the following CSS codes to your style.css file to make your AI image generator website beautiful and user-friendly. You can customize the different CSS properties, such as color, background, font, etc., to give a personalized touch to your website. 


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

:root {
    --bg: #222;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #222;
    position: relative;
}

/* .container {
    position: relative;
    top: 20px;
} */

.container ul {
    display: flex;
    position: relative;
    gap: 30px;
}

.container ul li {
    position: relative;
    list-style: none;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.5s;
}

.container ul li::before {
    content: "";
    position: absolute;
    inset: 30px;
    box-shadow: 0 0 0 10px var(--clr),
                0 0 0 20px var(--bg),
                0 0 0 22px var(--clr);
    transition: 0.5s;
}

.container ul li:hover::before {
    inset: 0;
}

.container ul li::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg);
    transform: rotate(45deg);
}

.container ul li:hover {
    z-index: 1000;
    transform: scale(0.75)
}

.container ul li a {
    position: relative;
    text-decoration: none;
    color: var(--clr);
    font-size: 2em;
    z-index: 10;
    transition: 0.5s;
}

.container ul li a:hover {
    font-size: 3em;
    filter: drop-shadow(0 0 20px var(--clr)) drop-shadow(0 0 40px var(--clr));
}



Conclusion and Final word

Now, we have reached the end of our code, for any information, you can comment any problem or code-not-working issues to resolve it, am always with you. You can also visit my YouTube Channel for more updates on HTML, CSS & JavaScript Designs. I believe you can create a "2024 Modern Button Hover Effects Using HTML and CSS". and do so much more with codes. Go extremely far in exploring the world of HTML, CSS & JavaScript, its gonna be fun, trust me 😃.

Happy Coding Journey 🚀

Post a Comment

0 Comments

Close Menu