Having trouble with clicking on an icon link within a list

Seeking assistance with creating a social media icon/link list for the first time on this platform. Any help is appreciated!

    <div class="social-links">
    <ul>
      <li class="m-link">
        <a href=""><i class="far fa-envelope"></i></a>
      </li>
      <li class="m-link">
        <a href=""><i class="fab fa-linkedin-in"></i></a>
      </li>
      <li class="m-link">
        <a href=""><i class="far fa-address-card"></i></a>
      </li>
    </ul>
  </div>
  .m-link {
  width: 2em;
  height: 2em;
  text-align: center;
  list-style: none;
  margin: 10px 30px;
  display: inline-block;
  font-size: 2.5em;
  line-height: 2em;
  color: #e2e2e2;
  border: 1px solid #e2e2e2;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.5s;
}
.m-link:hover {
  background-color: #e2e2e2;
  color: #0b0a08;
  box-shadow: 0 0 15px #9ecaed;
}
.m-link a {
  text-decoration: none;
  color: #e2e2e2;
}

Encountering an issue where hover color does not apply to the icon/link when hovered over. Attempted to add additional hover effect for ".m-link a" but it only works when cursor is on the link, not on the list element itself. As a beginner, seeking guidance from experienced individuals. Thank you in advance!

Answer №1

To achieve the desired effect of targeting the element inside the element on hover, you can use the following CSS code:

.m-link:hover a > i {
  background-color: #e2e2e2;
  color: #0b0a08;
  box-shadow: 0 0 15px #9ecaed;
}
 .m-link {
  width: 2em;
  height: 2em;
  text-align: center;
  list-style: none;
  margin: 10px 30px;
  display: inline-block;
  font-size: 2.5em;
  line-height: 2em;
  color: #e2e2e2;
  border: 1px solid #e2e2e2;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.5s;
}
.m-link:hover a > i {
  background-color: #e2e2e2;
  color: #0b0a08;
  box-shadow: 0 0 15px #9ecaed;
}
.m-link a {
  text-decoration: none;
  color: #e2e2e2;
}
<script src="https://kit.fontawesome.com/9114d9acc8.js" crossorigin="anonymous"></script>
<div class="social-links">
    <ul>
      <li class="m-link">
        <a href=""><i class="far fa-envelope"></i></a>
      </li>
      <li class="m-link">
        <a href=""><i class="fab fa-linkedin-in"></i></a>
      </li>
      <li class="m-link">
        <a href=""><i class="far fa-address-card"></i></a>
      </li>
    </ul>
  </div>

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

How can I validate HTML input elements within a DIV (a visible wizard step) situated within a FORM?

I recently made a decision to develop a wizard form using HTML 5 (specifically ASP.NET MVC). Below is the structure of my HTML form: @using (Html.BeginForm()) { <div class="wizard-step"> <input type="text" name="firstname" placeholder ...

Expandable sidebar using responsive Twitter Bootstrap

I am in search of a CSS solution to implement a button that can toggle a sidebar on and off using twitter bootstrap. Is there a specific term for those small icons seen on webpages that resemble pull tabs when the sidebar is closed and then move along wit ...

Tips for refreshing HTML multiple file upload without reloading the page

I am currently working on a feature that involves counting the number of files uploaded. If more than 10 images are uploaded, I want to clear the input field while keeping everything else in the form intact. Everything was working fine until I encountered ...

Safari is truncating the box-shadow of an element enclosed within a button

I'm struggling with a button that has an element inside receiving a box-shadow: button { padding: 0; border: 0; margin: 0; overflow: visible; -webkit-appearance: none; background: white; } .shadow { display: inline-block; vertical- ...

What steps do I need to take to launch an embedded kml tour?

This marks the beginning of my journey into the world of online forums! I used to rely on Stack Exchange for answers to my questions, but most of the time, someone else had already asked what I needed to know. It goes to show how effective this website is. ...

Conceal the slider thumb within the material-ui framework

I've been attempting to conceal the slide thumb, initially without using a library. However, I started considering utilizing material-ui as it might make the process easier. Hence, I'm seeking assistance here. Below is my code snippet: import * ...

Are there any universal methods for enlarging the size of a checkbox without altering the HTML structure?

Is it possible to adjust the size of a <input type="checkbox"> in a way that works across all browsers without changing the HTML markup? I attempted to modify the height and width using CSS, but encountered issues such as pixelation in Firefox and o ...

Enhancing the appearance of each letter within a word

I am currently working on styling the word "Siteripe". Each letter should have a different color, just like it is shown on this website. I have successfully styled only the first letter using the following CSS code: #namer:first-letter { color:#09C; f ...

Incorporate an XNA game directly into a website

Is it possible to launch an XNA game directly from a web page without the need for any installations? Something along the lines of Java, Silverlight, or similar to WPF Browser Applications (XBAP). Situation: Visit a webpage, Prompted to install the g ...

CSS Trick: Applying first-of-type selector to specific instances of a div

I'm currently grappling with how to specify that a 'first-of-type' should only be present on specific instances of a div. For instance, suppose I have a class called ".maintext" and in some cases I want the first paragraph to feature a dropc ...

jquery's each method is not functioning as intended and causing unexpected issues

I'm in the midst of developing a website, and one section requires users to input their details into a form. My goal is as follows: When a user clicks the submit button with any empty fields, I want a span element (initially set to display none in CS ...

View the selected radio buttons and checkboxes next to each other in real-time before finalizing and submitting

Within my form, individuals have the option to select from radio buttons and checkboxes. The challenge is that I need to display the chosen data on the page before they enter their email and submit! Since I cannot refresh the page, PHP won't work for ...

What is the best way to set up a loop for displaying Chat Bubbles?

Is there a way to create a loop for chat bubbles? I want them to appear on the right when I send a message and on the left when the chat partner replies. How can I implement this loop? This is the code I currently have: <div class="Webview"> &l ...

Step-by-step guide for embedding a Big Commerce website into an iframe

Can a website be opened inside an iframe? If not, is it possible to display a message like 'page not found' or 'this website does not allow data fetching in iframes'? <!DOCTYPE html> <html> <body> <h1>Using the ...

Enhancing the visual appeal of a standard jQuery slider with thumbnails

Recently, I incorporated the Basic jQuery slider into my website, which can be found at . As a novice in jQuery but well-versed in HTML and CSS, I have managed to make it work seamlessly on my site. However, I am curious to know if there is a way to displa ...

Ways to increase the font size of the text within the button for forum actions

<form action="https://www.kroger.com/account/communityrewards/" > <input type="submit" value="Go to Krogers" style="height: 50px; width: 150px;" /> </form> I'm interested in learning how to increase the font size of the form action ...

Attempting to extract a parameter from a URL and pass it as an argument to a function for the purpose of locating objects based on

I am trying to retrieve data from a URL http://localhost:3000/share/user=sampleuser to display objects with an author value that matches the one in the URL. However, I encountered an error when attempting to call a function that extracts the value from t ...

Concealing div containers and eliminating gaps

Looking for a way to filter div boxes using navigation? Check this out: <ul> <li><a href="javascript:void(0);" data-target="apples">Appels</a></li> <li><a href="javascript:void(0);" data-target="bananas">Ban ...

One of the unique CSS properties found in the NextJS setup is the default 'zoom' property set to

Even though I already found a solution to the problem, I can't help but wonder what the author meant by it. Hopefully, my solution can help others who may encounter the same issue. After installing the latest NextJS version 13.2.4 on my computer, I e ...

Exploring the art of styling in Angular6

I am looking to change the text color when a specific ID is clicked <nav class="navbar "> <ul class="navbar-nav"> <li *ngFor="let item of items"> <a class="nav-link" >{{item.title}}</a> ...