How to create Hover effect button design.
today we will show you how to make button design for your website.like this.
so let's start it.
first we create button tag and give a class "learn-more"
then under button tage create span tag give a class "circle", now another span create we will give two classes one"icon" second "arrow".Now make another Span tag give class "button-text".
we complated html coding
we make html like this.
<button class="learn-more">
<span aria-hidden="true" class="circle">
<span class="icon arrow"></span>
</span>
<span class="button-text">Learn More</span>
</button>
now we styling of our html code let's start.
create .css file and link with your html file like this.
<link rel="stylesheet" type="text/css" href="name.css">
take a button class name and code it
.learn-more {
width: 12rem;
height: auto;
position: relative;
display: inline-block;
cursor: pointer;
outline: none;
border: 0;
vertical-align: middle;
text-decoration: none;
background: transparent;
padding: 0;
font-size: inherit;
font-family: inherit;
}
style the circle like this
.circle {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
position: relative;
display: block;
margin: 0;
width: 3rem;
height: 3rem;
background: #282936;
border-radius: 1.625rem;
}
after circle styling take icon class and style it.
.learn-more .circle .icon {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
position: absolute;
top: 0;
bottom: 0;
margin: auto;
background: #fff;
}
now take arrow class.
.learn-more .circle .icon.arrow {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
left: 0.625rem;
width: 1.125rem;
height: 0.125rem;
background: none;
}
now we will use pseude class for example before.
.learn-more .circle .icon.arrow::before {
position: absolute;
content: "";
top: -0.29rem;
right: 0.0625rem;
width: 0.625rem;
height: 0.625rem;
border-top: 0.125rem solid #fff;
border-right: 0.125rem solid #fff;
transform: rotate(45deg);
}
style the text-button.
.learn-more .button-text {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0.75rem 0;
margin: 0 0 0 1.85rem;
color: #282936;
font-weight: 700;
line-height: 1.6;
text-align: center;
text-transform: uppercase;
}
use hover selector for animation.
.learn-more:hover .circle {
width: 100%;
}
.learn-more:hover .circle .icon.arrow {
background: #fff;
transform: translate(1rem, 0);
}
.learn-more:hover .button-text {
color: #fff;
}
now we @supports its a specific CSS features.called feature query.
@supports (display: grid) {
body {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 0.625rem;
grid-template-areas: ". main main ." ". main main .";
}
so this is is now run your file in your browser i hope result very good.

it is a very good blog i like it thank you for information
ReplyDelete