What is the best way to achieve a hover effect for glyphicon icons?

Does anyone know why my glyphicon icon isn't appearing when I hover over it? I'm using the <span> tag, but it's not working. What am I missing?

custom.css

 /*
 *= require bootstrap3-editable/bootstrap-editable
 *= require bootstrap-datepicker3
 *= require_tree .
 */

  @import "bootstrap-sprockets";
  @import "bootstrap";

.hovering:before {
display: none;
}

.hovering:hover:before {
display: block;
}

Here is how it looks in my HTML:

  <span class='hovering'>
    <%= link_to user_task_path(current_user, task.id), method: :delete,
    data: { confirm: 'Are you sure?' }, remote: true do %>
      <i class="glyphicon glyphicon-trash"></i>
    <% end %>
  </span>

Answer №1

The Glyphicon icon is not a pseudo-element within the .hovering element, but rather a pseudo-element inside the i element it contains. As a result, we must also target the i element:

.hovering i::before {
    display: none;
}

.hovering:hover i::before {
    display: block;
}

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

Sending data from local storage to ajax call

Below is the code snippet in question: $.ajax({ url: localStorage.getItem("isntagram link"), // url: "https://api.instagram.com/v1/users/self/feed?access_token=233291163.8a612cd.c49f77de073746e9a2f53116b720302e", met ...

What is the best way to eliminate the gap above a block element using CSS?

Currently in the process of designing a website, I am faced with a challenging issue that seems to have me stumped. The structure of my page consists entirely of HTML DIVs, with certain elements nested within their parent DIVs. My main dilemma lies in tryi ...

Managing User Permissions and Submitting Forms using Django

Creating a user-friendly Q&A platform where users can ask and answer questions. I'm exploring the idea of organizing users into groups to assign permissions. I believe creating groups is the most efficient way, but I'm open to suggestions. M ...

Having issues with my Bootstrap navigation dropdown - any suggestions on what I might be overlooking?

I'm having trouble getting the bootstrap dropdown and button to function properly when the menu collapses on tablet or mobile view. Below is my HTML code for the navigation: <nav class="navbar navbar-default navbar-fixed-top"> <div c ...

Steps for replacing the firestore document ID with user UID in a document:

I've been attempting to retrieve the user UID instead of using the automatically generated document ID in Firebase/Firestore, but I'm encountering this error: TypeError: firebase.auth(...).currentUser is null This is the content of my index.js ...

Show information from server in JSON format utilizing jQuery and ajax calls

I am facing what appears to be a straightforward issue. However, I am new to AJAX and despite my efforts to research, I have not been able to find a suitable solution. When I click a button on my Flask app/webserver, I fetch data from a route. My goal is ...

Content overflowing the container - Designed to adapt to different screen sizes

I'm currently working on a project within the Bootstrap 3 framework and struggling with an issue regarding text overflow in extra small view. The text is not behaving as expected, as it should stick to its container and break accordingly. I've ex ...

"Fetching a textbox value and passing it into an anchor tag query string: a step-by-step

What is the best way to extract a value from an "asp:TextBox" and insert it into an anchor tag? The asp:TextBox I am working with is labeled txtTaskName. <a href='EmailManager.aspx?<%# Eval(txtTaskName.Text) %>' runat="server">Add E ...

Using CSS Zoom / Transform with the iframe Tag in HTML

I'm currently working on embedding a child web page (a plain HTML/PHP file) into a parent web page built on WordPress. The challenge I'm facing is that the parent web page has a width of only 800px, whereas the child web page has a width of appro ...

The issue arises when React child props fail to update after a change in the parent state

Here's the main issue I'm encountering: I am opening a websocket and need to read a sessionId from the first incoming message in order to use it for subsequent messages. This should only happen once. I have a child component called "processMess ...

Navigating to a different page using JavaScript

Here is the code snippet I am working with: <p> <img alt="" src="imagini/slide1.png" style="height: 64px; width: 64px" id="imgClickAndChange" onclick="changeImage()" /> </p> <script language="javascript"> f ...

Modifying color with jQuery based on a condition

My attempt to alter the CSS (color font) of tr using code is not yielding the desired results. Interestingly, removing the condition and simply using $(this).css("color","white"); works flawlessly. However, incorporating it within an ...

When conducting unit testing with Express, encountering an error message such as "`call of undefined`" may indicate that

In my current quest to test a node.js application using express, I encountered an issue. After successfully returning a simple 404.html page, I attempted to close the node http server, resulting in an error: Fatal error: Cannot call method 'call&apos ...

Struggles working with css in react applications

Looking for some assistance here... In the code snippet below, I have two separate elements that I want to display one at a time. The first element is an iframe and the second is a div. The idea is that if the user clicks on the {title}, the frame disap ...

Is it possible to display only the top level elements of a nested collection in Jekyll?

When using Jekyll Liquid templates, is there a way to render items from a collection at the top of a hierarchy using a for loop? proj_folder - _items • item_1.md • item_2.md - subfolder_1 • item_1-1.md • item_1-2.md - ...

I'm having trouble getting the infoWindow to function properly

As someone who is new to JavaScript, I recently came across a question on Google Maps JS API v3 - Simple Multiple Marker Example and attempted to implement the solution provided by Daniel Vassallo. var Australia = new google.maps.LatLng(-27.16881, 132.7 ...

CSS transitioning can be tricky when trying to fade an image or video with a solid background alongside an HTML element that shares the same background color

When attempting to apply a fade in/out effect to an image or video with a solid background color and using the same transition for the opacity of an html element with a matching background color, a noticeable "square" appears around the image/video. Why d ...

Header unresponsive to user interactions

Hey everyone! I'm new to using Foundation and I've hit a roadblock in my code on a medium-sized device. I would greatly appreciate your input to help me identify my mistake. Below is the snippet of my code: <div class="row"> <div cl ...

Creating a dynamic popup that is triggered by clicking on a specific row within a table

I'm currently struggling with positioning a popup in the center of the screen and making it responsive. The code I'm using involves generating a popup for each table row, but I haven't been successful in achieving the desired result. Edit: ...

What is the most suitable Vue.js component lifecycle for data retrieval?

I recently came across an article on Alligator.io discussing the drawbacks of using the mounted lifecycle in Vue for HTTP requests. This got me thinking, are there any best practices or guidelines for fetching data from APIs in Vue.js? ...