An innovative hover effect that activates without the need to physically hover

Is there a way to create a continuous hover effect on links without the need for constant hovering to indicate that the text is a link? Currently, I have an effect where the cursor triggers an animation to underline the text when hovered over. However, I would like to make this effect always active in a loop. Can someone assist me with this?

.continuous-hover{
  position:relative;
  text-decoration:none;
}
.continuous-hover2{
  position:relative;
  text-decoration:none;
  content:'';
  position:absolute;
  bottom:0;
  right:0;
  width:0;
  height:2px;
  background-color:red;
  transition:width 0.6s cubic-bezier(0.25,1,0.5,1);
  -moz-animation:linky 2s infinite ease-in-out;
  -webkit-animation:linky 2s infinite ease-in-out;
}
@keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
}
@-moz-keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
}
@-webkit-keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
} 
.continuous-hover::before{
  content:'';
  position:absolute;
  bottom:0;
  right:0;
  width:0;
  height:2px;
  background-color:Red;
  transition:width 0.6s cubic-bezier(0.25,1,0.5,1);
}
.continuous-hover:hover::before{
  background-color:red;
  left:0;
  right:auto;
  width:100%;
}

<a href="WWW.google.pt" class="T3Ccontinuous-hover"> this text will have a continuous border-bottom effect </a>

Answer №1

Set the animation inside the before element:

.underlineshadow{
  position:relative;
  text-decoration:none;
}

@keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
}
@-moz-keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
}
 @-webkit-keyframes linky{
  0%{
    width:0%;
  }
  100%{
    width:100%;
  }
} 
.underlineshadow::before{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  right:auto;
  width:0;
  height:2px;
  background-color:red;
  transition:width 0.6s cubic-bezier(0.25,1,0.5,1);
  -moz-animation:linky 2s infinite ease-in-out;
  -webkit-animation:linky 2s infinite ease-in-out;
  animation:linky 2s infinite ease-in-out;
}
<a href="WWW.google.pt" class="underlineshadow"> This text will have a bottom border effect </a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The bottom border of the HTML header does not properly wrap around the Table of Contents (ToC), although the text within the header does. What steps

I have created a Table of Content (ToC) using a Div element and styled it with the following HTML and CSS: h3.articletitle { font-weight: bold; font-size: 30px; border-bottom: 1px solid #4F120B; } h4.articlesubtitle { font-weight: bold; ...

Comparing adjust-leading-to with leader in Compass - what sets them apart?

Currently exploring Compass and feeling a bit puzzled about the functionality of two mixins: adjust-leading-to and leader. Would appreciate it if someone could clarify the distinction between them. ...

How can I ensure that images remain within the link elements in a flex container?

I'm currently assisting a colleague with his website. His main request is to have the two images positioned below the larger image at the beginning of the page align perfectly with the edge of the page, so that the right image lines up with the one ab ...

Achieving a similar behavior to a Node.TEXT_NODE with Node.ELEMENT_NODE in the context of flex-direction: column CSS

Below, you'll notice that the div._b5a is set as a flex container with flex-direction: column. Typically, its child is just a text sentence (nodeType == Node.TEXT_NODE): 新增個人簡介,讓大家更瞭解你, which means the text sentence remains ...

What could be causing my paragraph to shift when an animated expanding header is applied in CSS?

For a school assignment, I am facing an issue where the paragraph is being affected by my CSS animation on the main header title that expands and contracts. My goal is to keep the paragraph in a fixed position without being moved by the header animation (V ...

Adjust the font size within a container using HTML code, no CSS required

Is it possible to directly change the TextSize and TextColor within the HTML Document? I need it to be within this specific box (same class) because of the background color. However, the text size always remains the same. The HTML line is: Which button re ...

Convert <td> into a clickable <a> link with [ajax] functionality

I'm looking to display a MySQL query result field in HTML as a clickable, formatted link. //I need to turn clmLink into a clickable link while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td ...

Unable to enclose an element with an HTML structure

I am attempting to take all the elements marked with the table tag and envelop them in an HTML structure to make the tables responsive. However, it appears that my current approach is not yielding the desired results. Can you please provide some insight ...

Creating a horizontal navigation bar using localscroll.js in your website is a great way

In my portfolio, I want to create a horizontal navigation with local scroll to showcase a gallery of various pictures. For this, I have a (div id="projects") with links structured like this: <div id="projects"> <ul id="content-slider-inside ...

Tips for fashionable dressing &

Can you provide some insights on how to format the &amp; symbol in this HTML snippet? <a>Ian</a> &amp; <a>Jim</a> ...

Exploring ways to customize the input color of Material UI TextField when it is disabled [Version: 5.0.8]

I am having trouble changing the border color and text color when an input is disabled. I have tried multiple variations, as seen below: const textFieldStyle = { '& label': { color: darkMode?'#1976d2':'', } ...

Open the window by using the `Window.open` method, then find and

Is there a way to open a document, not in a new window but on the same page using JavaScript.Window.Open()? Could it be possible to display the document within a specific div element that is obtained with getElementById? For example: document.getElementB ...

Challenger arises in the realm of Chakra UI styling

Recently, I've encountered an issue with displaying a card using chakra UI and next js. The CSS of chakra UI seems to be messed up, causing all my components to display incorrectly. It was working perfectly fine until yesterday. I tried deleting the . ...

"Illuminating the way: Adding a search bar to your

Looking to enhance my WordPress blog with a search bar, I opted for a generic HTML approach over using get-search-form(). Here is the code snippet from my theme: <div class="input-group"> <input type="text" class="form-c ...

Utilizing jQuery UI to dynamically alter CSS classes

I'm currently working on a project and could use some assistance. I have divs that are droppable using jQuery UI. While everything is functioning properly and I can drag and drop, I am looking to modify the opacity of the div I am dragging by changing ...

Creating a "briefing" iframe at the top of a webpage

I'm looking for a way to allow users to embed my iframe at a specific size, like 100x100, and then have it resize dynamically to fit the page size when they click on it. I want this functionality to work regardless of how the HTML embedding the iframe ...

The container has an overflow set to scroll, however, I would like certain elements to overflow outside of it

I am facing an issue with a container that has a set overflow-y: scroll property. Within this container, I have multiple elements including a dropdown menu. The challenge lies in ensuring that the dropdown menu can overflow the container as needed. Despite ...

What is the best way to conceal the bottom portion of an image?

My image in the header overlaps with the next section's features (image-phone). https://i.sstatic.net/4g0SO.jpg I've tried changing the position and z-index types. If I crop the image, it's not ideal and difficult to fix ;) How can I stru ...

Is there a way to trigger element closure using the esc key?

I have a panel that shows on initialization and hides when I press the 'close' icon. How can I make the panel close when I press the 'esc' button? Below is the HTML code for the panel: <div ng-init="vm.onInit()" class="mainContent"& ...

Create a situation where a span intersects with an "overflow" element

I have come across an issue with my webpage. I am utilizing a menu of icons on the left side, and it shows a span when I hover over an icon. Since my list is quite long, I want it to display a scrollbar if the window size is smaller: overflow-y: auto; ove ...