1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Text underline on hover in text module?

Discussion in 'Free Divi Community Forum' started by aspirmusc, Dec 1, 2023.

  1. aspirmusc

    aspirmusc New Member

    How do I do something like this:

    https://stackoverflow.com/questions/54616139/how-to-animate-underline-from-left-to-right/69150401

    in a Divi text module?

    Everything I keep seeing when I search is for a menu header, which I actually have using this code in the Divi custom CSS section on the theme options page:

    #top-menu .current-menu-item a::before,
    #top-menu .current_page_item a::before {
    content: "";
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    }
    #top-menu li a:before {
    content: "";
    position: absolute;
    z-index: -2;
    left: 0;
    right: 100%;
    bottom: 50%;
    background: #626267; /*** COLOR OF THE LINE ***/
    height: 2.5px; /*** THICKNESS OF THE LINE ***/
    -webkit-transition-property: right;
    transition-property: right;
    -webkit-transition-duration: 0.3s;
    transition-duration: 0.3s;
    -webkit-transition-timing-function: ease-out;
    transition-timing-function: ease-out;
    }
    #top-menu li a:hover {
    opacity: 1 !important;
    }
    #top-menu li a:hover:before {
    right: 0;
    }
    #top-menu li li a:before {
    bottom: 10%;
    }

    However, I want to be able to do this in regular text modules so when I hover over a specific text on the screen an underline from left to right happens.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade horizontal timeline design for your Divi site without using any plugins:View Demo
  2. Suzanne

    Suzanne New Member

    Have you tried the various options for code given on StackOverflow? Ideally I think the code needs to go in the Divi area for code so that when your hovers are done throughout the site, they all work. Doing them page by page may not work.
     
  3. Suzanne

    Suzanne New Member

    Put this code in the Divi css section:
    .
    .un {
    display: inline-block;
    }

    .un:after {
    content: '';
    width: 0px;
    height: 2px;
    display: block;
    background: black;
    transition: 300ms;
    }

    .un:hover:after {
    width: 100%;

    Then where you want the text animated with underline you go to text editor on the page and the text you want underlined you put this:
    <span class="un">Underlined Text</span>
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade gallery carousel design for your Divi site without using any plugins:View Demo