Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to Apply Shadow Effect on Text Using CSS?
Next article icon

How to apply Hover Effect in CSS?

Last Updated : 19 Nov, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The :hover pseudo-class in CSS is used for styling when an element is hovered over by a cursor.

Syntax

a:hover {
// CSS Styles...
}
HTML
<!DOCTYPE html> <html>  <head>     <style>         .hover-button {             background-color: #4CAF50;             padding: 15px 30px;             font-size: 16px;             cursor: pointer;         }          .hover-button:hover {             background-color: #254d27;             color: white;         }     </style> </head>  <body>     <h3>Hover Effect Example</h3>     <button class="hover-button">Hover Over Me!</button> </body>  </html> 

Output

hover-effect
hover effect

Next Article
How to Apply Shadow Effect on Text Using CSS?

P

pankaj_gupta_gfg
Improve
Article Tags :
  • Web Technologies
  • CSS-Questions
  • CSS-QnA

Similar Reads

  • How to create icon hover effect using CSS ?
    To style an icon's color, size, and shadow using CSS, use the color property to set the icon's color, font size to adjust its size, and text-shadow or box-shadow for adding shadow effects, creating a visually appealing and dynamic look. Using: hover Pseudo-ClassUsing the: hover pseudo-class, you can
    2 min read
  • How to disable a CSS :hover effect?
    Disabling a CSS :hover effect means preventing the visual changes applied when an element is hovered over by the cursor. This can be done by overriding the :hover styles with none or applying the effect conditionally using JavaScript or specific classes to control when the hover state is active. Her
    3 min read
  • How to Apply Shadow Effect on Text Using CSS?
    The CSS text-shadow property is used to add a shadow to the text. Adding a shadow to text using CSS text-shadowThe text-shadow property of CSS is used to apply the shadow effect on text. It takes four values verticalShadow, horizontalShadow, blur, and color. Syntax text-shadow: verticalShadow horizo
    1 min read
  • Tailwind CSS Hover Effects
    A hover effect is a visual change that occurs when a user moves their mouse pointer over an element on a webpage. We can achieve a hover effect by Tailwind CSS built-in prefix modifier called "hover: ". These are the following ways to use hover: Table of Content Simple Hover Effect (Background color
    3 min read
  • How to Modify Hover Effect using Tailwind CSS ?
    In Tailwind CSS, the term "modify hover" refers to changing the styles that are applied to an element when it is hovered over. With Tailwind CSS "hover" variation, you can quickly apply particular utility classes and custom classes to control how components appear when you hover over them, giving yo
    3 min read
  • How to apply hover effect over button using SASS ?
    Animation makes the user experience more beautiful and impressive. With the usage of HTML (HyperText Markup Language) elements and SASS ( Syntactically Awesome Stylesheet), we will design buttons that provide them with a colorful border and an animation effect. We will use Sass because it acts as a
    5 min read
  • How to make Profile Card Hover Effect using CSS ?
    Almost all of us must have heard that 'the first impression is the last impression'. The profile card carries the most important details we should know about a person at the very first instant. A better impression attracts more traffic. So to engage more audience in a website it is very important to
    3 min read
  • How to Add Shadow Effect on Hover to DIV Boxes in CSS ?
    Here are two methods to add shadow effect on hover of a div container in CSS. 1. Using box-shadow PropertyThe box-shadow property is used to add shadow effects around an element's frame. You can specify the horizontal and vertical offsets, blur radius, spread radius, and color of the shadow. [GFGTAB
    1 min read
  • How to Zoom an Element on Hover Using CSS ?
    Zooming an element on hover using CSS involves creating an effect where an element, such as an image or button, increases in size when the user hovers over it. This interactive technique enhances user engagement by highlighting elements through smooth scaling animations. ApproachHTML Structure: Uses
    2 min read
  • How to Fade a Button on Hover using CSS ?
    Fading a button on Hover in CSS is a visually engaging effect that can be done using various approaches. Below are the approaches to fade a button on hover using CSS: Table of Content Using opacity PropertyUsing Linear Gradient with RGBA ValueUsing opacity PropertyThis approach utilizes the CSS opac
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences