UrbanPro
true

Learn CSS from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Awesome HTML and CSS hover button with transition effects

Akshay Khobragade
20/01/2017 0 0

Hello all today we will learn to make an awesome and easy button hover and transition effect.

1) Lets make a basic html button.



2) We have created a basic html 5.0 button, lets style it up with CSS, in ur css file -

button {
padding:5px 10px 5px 10px;
//comment - padding given is always clockwise padding: top right bottom left
//comment - lets add another features of css
border: 1px solid darkgreen;
background-color:darkgreen;
color:#ffffff; //comment - #ffffff stands for white color in hexadecimal
}

3) Now the important part, lets add the hover pseudo class for button

button:hover{
padding:5px 20px 5px 20px;
//comment - increase the right and left padding for our button
}

4)Now we the padding changes of the button when we hover over the mouse to the button, but the effect is instant. Lets try to add smmothness to that process by adding transition

button {
padding:5px 10px 5px 10px;
border: 1px solid darkgreen;
background-color:darkgreen;
color:#ffffff;
transition:all 0.5s ease; //comment - the transition time is 0.5 seconds, i.e when we hover over the mouse to the button, in 0.5 seconds the padding will increase from 10px to 20px.
}

5) So thats it, you have created an awesome hoverover button. Below is the full code

i) HTML 5.0 code -


ii) CSS 3.0 code -
button {
padding:5px 10px 5px 10px;
border: 1px solid darkgreen;
background-color:darkgreen;
color:#ffffff;
transition:all 0.5s ease;
}

button:hover{
padding:5px 20px 5px 20px;
}

---thank you---

 

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

HTMl tutorial for input type
<html> <body> <form> <input type="tel" id="phone" name="phone" pattern="{10}"required><br> <input type="submit" value="Submit"> </form> </body> </html>

HTML
HTML- Hyper Text Markup Language HYPER MEANS:For Example: Girls connected to jweleries, sarees, chocolates. Here there link to there intresting things.At the same way one word connected to other page....

Kick start your IT career with User Interface development
If you are planning to start your career into IT, you can begin as User Interface developer. No previous IT background or programming experience needed. Below are some of the responsibilties of User...

Kick start your IT career with User Interface development
If you are planning to start your career into IT, you can begin as User Interface developer. No previous IT background or programming experience needed. Below are some of the responsibilties of User...

Html elements and attributes
Html consists of a series if elements These elements tell the browser how to display the content Elements are specified with tagnames. They are enclosed in angular brackets. <> is the start...
X

Looking for CSS Classes?

The best tutors for CSS Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn CSS with the Best Tutors

The best Tutors for CSS Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more