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

Morphing Page Transition
Today we’d like to share a simple morphing page transition effect with you. The idea is to morph an SVG path while moving an intro page up, creating an interesting, flowy look. For the animations...

HTML
HTML is probably the easiest languages to learn every one, but often we give a lot of attention these days, as we do not focus on CSS. So to remind you of this, of course, and to help you with some great...
M

Mohit Ande

0 0
0

Angular-2 Developer Training Program Syllabus
Angular2 Developer Training Program Syllabus: Introduction to Angular2. Why Angular2. Angular2 Features: Components, Services and Typescript. Angular2 Components: Templates, Modules, Services...

CSS awesome tips
CSS - Cascading Style Sheet is used to beautify Web pages and there are some common things which are very basic yet conceptual and very important for development. So here are some of the important tips...

Angular-2 Developer Training Program Syllabus
Angular2 Developer Training Program Syllabus: Introduction to Angular2. Why Angular2. Angular2 Features: Components, Services and Typescript. Angular2 Components: Templates, Modules, Services...
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