Friday, October 11, 2019

Hover Effects in HTML and CSS

In this article, I would like to share the code written by my friend and fellow software engineer sir Ernel Fadriquilan

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.



Sample Program Output


Program Listing

index.html

<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<button class="btn btn1">Hover me</button>
<button class="btn btn2">Hover me</button>
<button class="btn btn3">Hover me</button>
<button class="btn btn4">Hover me</button>
</div>
</body>
</html>

style.css

body
{
margin: 0;
padding: 0;
}

.container
{
text-align: center;
margin-top: 360px;
}

.btn
{
border: 1px solid #3498db;
background: none;
padding: 10px 20px;
font-size: 20px;
font-family: "montserrat";
cursor: pointer;
margin: 10px;
transition: 0.8s;
position: relative;
overflow: hidden;
}

.btn1,.btn2
{
color: #3498db;
}

.btn3,.btn4
{
color: #fff;
}

.btn1:hover,.btn2:hover
{
color: #fff;
}

.btn3:hover,.btn4:hover
{
color: #3498db;
}

.btn::before
{
content: "";
position: absolute;
left: 0;
width: 100%;
heigth: 0%;
background: #3498db;
z-index: -1;
transition: 0.8s;
}

.btn1::before,.btn3::before
{
top: 0;
border-radius: 0 0 50% 50%;
}

.btn2::before,.btn4::before
{
bottom: 0;
border-radius: 50% 50% 0 0;
}

.btn3::before,.btn4::before
{
heigth: 180%;
}

.btn1:hover::before,.btn2:hover::before
{
height: 180%;
}

.btn3:hover::before,.btn4:hover::before
{
height: 0%;
}



No comments:

Post a Comment