search results:

    • Standard
    • React
    Pricing Learn Community
    • + D
    • Light
    • Dark
    • System
    logo TW Elements
    • Getting started
      • Quick start
      • Tutorials
      • Design system
      • Local installation
      • Optimization
      • Dark mode
      • Theming
      • Changelog
      • Migrating to v2
      • Internationalization guide
      • Class customization
      • Icons Integration
    • CommercialNew
      • Pricing
      • License
      • Installation
      • Git & repository
      • Premium Support
    • Integrations
      • Angular
      • ASP.NET
      • Django
      • Express
      • Laravel
      • Next
      • Nuxt
      • Qwik
      • React
      • Remix
      • Solid
      • Svelte
      • SvelteKit
      • Vue
    • Content & styles
      • Animations
      • Animations Extended
      • Colors
      • Dividers
      • Figures
      • Headings
      • Hover effects
      • Icons
      • Images
      • Mask
      • Shadows
      • Typography
    • Navigation
      • Breadcrumbs
      • Footer
      • Headers
      • Mega menu
      • Navbar
      • Offcanvas
      • Pagination
      • Pills
      • Scrollspy
      • Sidenav
      • Tabs
    • Components
      • Accordion
      • Alerts
      • Avatar
      • Badges
      • Button group
      • Buttons
      • Cards
      • Carousel
      • Chips
      • Collapse
      • Dropdown
      • Gallery
      • Jumbotron
      • Lightbox
      • Link
      • List group
      • Modal
      • Notifications
      • Paragraphs
      • Placeholders
      • Popconfirm
      • Popover
      • Progress
      • Rating
      • Scroll back to top button
      • Social buttons
      • Spinners
      • Stepper
      • Testimonials
      • Timeline
      • Toast
      • Tooltip
      • Video
      • Video carousel
    • Forms
      • Autocomplete
      • Checkbox
      • Datepicker
      • Datetimepicker
      • File input
      • Form templates
      • Input Group
      • Inputs
      • Login form
      • Multi range slider
      • Radio
      • Range
      • Registration form
      • Search
      • Select
      • Switch
      • Textarea
      • Timepicker
      • Validation
    • Data
      • Charts
      • Charts advanced
      • Datatables
      • Tables
    • Methods
      • Clipboard
      • Infinite scroll
      • Lazy loading
      • Loading management
      • Ripple
      • Scrollbar
      • Smooth scroll
      • Sticky
      • Touch
    • Design Blocks
      • Admin Charts
      • Admin Complex
      • Admin Forms
      • Admin Maps
      • Admin Navigation
      • Admin tables
      • Banners
      • Contact
      • Content
      • CTA
      • FAQ
      • Features
      • Headers
      • Hero / Intro sections
      • Logo clouds
      • Mega menu
      • News
      • Newsletter
      • Pricing
      • Projects
      • Stats
      • Stats admin
      • Team
      • Testimonials
    • Tools
      • Button generator
      • Card generator
      • Flexbox generator
      • Footer generator
      • Form builder
      • Grid generator
      • Icon generator
      • Instagram Filters generator
      • Logo generator
      • Table generator
      • Typography generator
    • Coming Soon
      • Angular
      • Builder
      • Templates
      • Vue
    • Resources
      • Playground
      • YouTube Channel
      • Private FB Group
      • Newsletter
      • UI Design course New
      • UI / UX tips

    Hover effects

    Tailwind CSS Hover Effects

    Responsive hover effects built with Tailwind CSS. Hover effect appears when the user positions the computer cursor over an element without activating it.


    Basic example

    Hover effect appears when a user positions computer cursor over an element without activating it.

    Louvre
    • HTML
    • javascript
            
                
          <div
            class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat"
            data-twe-ripple-init
            data-twe-ripple-color="light">
            <img
              src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
              class="max-w-xs"
              alt="Louvre" />
            <a href="#!">
              <div
                class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-[hsl(0,0%,98.4%,0.2)] bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-100"></div>
            </a>
          </div>
          
            
        
            
                
          // Initialization for ES Users
          import {
            Ripple,
            initTWE,
          } from "tw-elements";
          
          initTWE({ Ripple });
          
            
        

    Showing the animation effect

    As you can see in the above example, you can add any animation to any element on the page by using the following classes:

    • transition: used to animate the chaged properties on hover,
    • duration-x: used to define the duration of the animation where x is the time in milliseconds; e.g. duration-300.

    Then, you should be able to add any type of animation by changing the property on hover by using the class: [hover:tw-class-name] e.g. hover:opacity-100.

    Hey there 👋 we're excited about TW elements and want to see it grow! If you enjoy it, help the project grow by sharing it with your peers. Every share counts, thank you!

    Color

    Change the color and opacity by manipulating color and .hover:opacity-* classes. Have a look at our masks docs to learn more.

    Louvre
    Louvre
    Louvre
    Louvre
    Louvre
    Louvre
    • HTML
            
                
          <div class="grid grid-cols-3 gap-4">
            <div class="mb-4">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-indigo-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-50"></div>
              </div>
            </div>
            <div class="mb-4">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-purple-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-20"></div>
              </div>
            </div>
            <div class="mb-4">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-green-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-70"></div>
              </div>
            </div>
          </div>
          <div class="grid grid-cols-3 gap-4">
            <div class="mb-4 md:mb-0">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-red-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-30"></div>
              </div>
            </div>
            <div class="mb-4 md:mb-0">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-white bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-40"></div>
              </div>
            </div>
            <div class="mb-4 md:mb-0">
              <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  class="max-w-xs"
                  alt="Louvre" />
                <div
                  class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-blue-400 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-60"></div>
              </div>
            </div>
          </div>
          
            
        

    Gradient

    Set a fancy gradient as an overlay.

    Louvre
    • HTML
            
                
          <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
            <img
              src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
              class="max-w-xs"
              alt="Louvre" />
            <div
              class="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 opacity-0 transition duration-300 ease-in-out hover:opacity-70"></div>
          </div>
          
            
        

    Zoom

    Use .hover:scale-110 class to any element to apply zoom.

    Louvre
    • HTML
            
                
          <div class="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
            <img
              src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
              class="max-w-xs transition duration-300 ease-in-out hover:scale-110"
              alt="Louvre" />
          </div>
          
            
        

    Shadow

    Use .hover:shadow-lg class to any element to apply the effect.

    Louvre
    • HTML
            
                
          <img
            src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
            class="max-w-xs transition duration-300 ease-in-out hover:shadow-lg dark:hover:shadow-black/30"
            alt="Louvre" />
          
            
        

    Related resources

    Tutorials:

    colors icons hover state focus active and others masks hsla colors buttons ripple effect shadows sizing

    Extended Docs:

    animations colors icons images mask dropdown modal popover rating tooltip background image colors display none hero icons icons text color text decoration

    Generators and builders:

    Form drag & drop Typography SVG icon Instagram Filters button card table flexbox logo grid footer

    Design System (Figma):

    introduction lowering the contrast user experience do not start with the roof project personality design system plan the process principles tips and tricks
    • Basic example
    • Color
    • Gradient
    • Zoom
    • Shadow
    • Related resources
    Get useful tips & free resources directly to your inbox along with exclusive subscriber-only content.
    Join our mailing list now
    © 2024 Copyright: MDBootstrap.com

    Access restricted

    To view this section you must have an active PRO account

    Log in to your account or purchase an TWE subscription if you don't have one.

    Buy TWE PRO