Troubleshooting CSS Hover Not Displaying Properly in Angular 14

In the footer class of my HTML, there is a code snippet with chevrons:

<div class="link-list">
    <div *ngFor="let link of insideLinksLeft | originalOrderKeyValue" class="link">
        <a [href]="link.value" class="animated-link">{{link.key}} <i class="arrows-right fas fa-chevron-right fa-xs"></i></a>
    </div>
</div>

I want the arrows-right to move right on hover over the animated link. Here's what I've tried:

.arrows-right {
    margin-top: 13px;
    margin-left: 10px;
}

.arrow-right:hover {
    right: 20px;
}

The CSS for arrows-right works but not when inside an <a> tag. If you have a better solution, please let me know.

I also attempted this approach without success:

a.animated-link {
        color: #D1E2FF;

        &:hover {
            color: white;
        }
        &:hover .arrow-right {
            transform: translate(-50%, 0);
        }
      }

Below is the complete CSS page layout for reference:

@import "/src/assets/style/variables";

@background-black: #4A4A4A;

.footer-wrap {
  width: 100%;

  .links-footer-wrap {
    padding: 50px 0;
    background: @background-black;

    .col {
      padding: 0 45px;
      border-left: 1px solid @border-gray;

      &:first-child {
        border: none;
        padding-left: 0;
      }

      .col-title {
        color: white;
        font-size: 28px;
        margin-bottom: 10px;
      }

      .link-list-wrap {
        display: flex;
        justify-content: space-between;
      }

      .link {
        min-width: 205px;
        margin-bottom: 10px;
      }

      a.animated-link {
        color: #D1E2FF;

        &:hover {
            color: white;
        }
        &:hover .arrow-right {
            transform: translate(-50%, 0);
        }
      }

      img {
        width: 100%;
        margin-bottom: 10px;
      }
    }
  }

  .arrows-right {
    margin-top: 13px;
    margin-left: 10px;
  }

  .arrow-right:hover {
    right: 20px;
  }

  .privacy-footer-wrap {
    font-size: 13px;
    padding: 15px 0;
    background: #F7F4EE;

    .privacy-footer {
      display: flex;
      justify-content: space-between;

      .policy-link-wrap {
        width: 210px;

        .privacy-link {
          color: @link-blue;
          font-weight: bold;

          &:hover {
              color: @hover-blue;
          }
         }
      }
    }
}
}

Answer №1

When the .arrows-right class is nested inside the animated-link class, you can easily apply the following CSS:

.animated-link:hover .arrows-right {
    margin: 15px;
}
<a class="animated-link> Link <i class="arrows-right"> Arrow </i></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

Problem with Bootstrap Dropdown positioning on mobile devices

I have encountered a puzzling issue with our web application. To demonstrate the problem, I have simplified the page to its bare minimum. You can access it here: Everything seems to be working fine on desktop browsers. However, when I test the page on a m ...

Implementing an API route to access a file located within the app directory in Next.js

Struggling with Nextjs has been a challenge for me. Even the most basic tasks seem to elude me. One specific issue I encountered is with an API call that should return 'Logged in' if 'Me' is entered, and display a message from mydata.tx ...

Ways to deactivate selecting rows in a datatable

Is there a way to deactivate the select feature specifically within datatables? An example of using ctrl+a for disabling select all function is available here https://i.stack.imgur.com/RQNXT.png ...

Animate the rotation of specific paths within the SVG

I've designed an SVG using Illustrator and I have a specific animation in mind for it. My goal is to create an animation where the upper part of the circle line rotates from left to right (considering that there are 4 circle lines, with number one st ...

Utilize JavaScript to send an email containing a link and content

In the html form, there are input fields for adding a new user to the database. Once a user is added, an email is sent to them using the sendmail() function in the adduser.js file. The email is sent successfully according to my standards. However, I want t ...

Retrieving images from a server via AJAX requests

As I delve into learning AJAX, I encountered an issue with retrieving an image from my WAMPSERVER www.directory. Within the IMAGES file, there is an image titled logo.png that I'm attempting to access using the following code: function loadXMLDoc() { ...

Tips for transferring an entire array to a servlet and retrieving it efficiently

I have been attempting to collect all jqgrid data into one array and send it to a servlet. So far, I have tried the following code snippet: var rows= jQuery("#list").jqGrid('getRowData'); var paras=new Arr ...

Exploring Multilingual Autocomplete or: Best Practices for Managing Multiple Languages in Web Applications

I'm currently developing a website and I have a mysql-table named 'items' with the following structure: item_id | item (The second column is used to identify the item_id.) In a file called language1.php, I have an array that stores the it ...

What is the best way to create a JavaScript array after fetching data from an AJAX request that returns a JSON array?

When I make an ajax call that returns JSON data, my goal is to extract and organize this data into a new JavaScript array through looping. This is a snippet of the JSON data returned: { query: [ ], products: 
[ 
{ title: "title 1", ...

Vue: Simple ways to retrieve state data in MutationAction

I'm having trouble accessing the state inside @MutationAction Here is the setup I am using: Nuxt.js v2.13.3 "vuex-module-decorators": "^0.17.0" import { Module, VuexModule, MutationAction } from 'vuex-module-decorators' ...

Could someone kindly clarify the workings of this jQuery script for me?

I found this code online, but I'm struggling to comprehend its functionality. In order to make any edits for my needs, I need to understand how it operates. The purpose of this script is to close a panel with an upward slide animation when the "x" but ...

What could be the reason for angularjs not functioning as expected?

After attempting to create a basic JavaScript unit test using angular.js, I encountered failure without understanding the reason behind it. test.html <html> <head> <script src="angular-1.2.21/angular-scenario.js" ng-autotest></ ...

Exploring the Fusion of Different Styles in Material-UI Using React

I have two different styles that I use in my code. One style is specific to certain components, while the other style is global and used across various components. For example, consider the following file tree: index.tsx -App.tsx -globalConstants.ts In ...

Grammarly is seamlessly inserting padding into my body element

After setting up my website on GitHub, I ran into an issue where the Grammarly Chrome extension was automatically adding a padding-top attribute to the body tag. <body data-new-gr-c-s-check-loaded="14.1028.0" data-gr-ext-installed="" ...

I'm unsure of the most efficient way to condense this statement

$(document).ready(function(){ if ($(window).width() <961){ $('.item').on('click',function(){ /*---do something---*/ }) }else{ $('.item').on('click',function(){ ...

Utilizing the closest method to retrieve the form element

As I review code written by another developer, I came across a surprising method used to retrieve a form object. HTML for Login Form <form id="frm_login" action=""> <input type="text" name="username" id="username"> <input type="passwor ...

The Magic of Javascript Routing with Regex Implementation

I'm currently developing a Javascript Router similar to Backbone, Sammy, and Spin. However, my specific requirements are rather straightforward. I need the ability to define a series of routes along with their corresponding callbacks, and I want to be ...

What are the ways to implement global functions in Vue.js?

I have a function that formats dates without time. I want to reuse this function in multiple components. What is the recommended approach for handling this scenario? Should I use directives, filters, or another method? How should I go about defining this ...

A guide to showcasing JSON data on a webpage using JavaScript

I am currently working on a SOAP WSDL invocation application in MobileFirst. The response I receive from the SOAP WSDL is in JSON format and is stored in the result variable. When trying to access the length of the response using result.length, I encounter ...

Serving Files in Express JS: the benefits of serving files directly from memory compared to serving static

Should I keep images and other assets in memory or serve them from static assets? Will often-requested static assets be stored in memory? Does anyone have insight into the performance implications of this decision? ...