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

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...

Learn Conceptually
Whenever you try to learn something, understand the concepts well. This will not only fix the idea in your mind but also help you comprehend the process.
S

Shweta Chauhan

0 0
0

HTML Style Attribute
Setting the style of an HTML element, can be done with the style attribute. <tagname style="property:value;"> Ex - HTML Background Color The background-color property defines the background...

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....

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