Adjust the color of a link when it is hovered on a div, and also modify the link color when it is hovered over

Apologies for the specific title, but this finalizes the look of my website. Check out my current code below:

.social {
background-color: rgba(150,150,150,0.75);
height: 150px;
width:200px;
margin: 20px;
display: inline-block;
    transition: background .25s ease, box-shadow 0.20s ease-in-out, color 0.20s ease;
    font-weight: bold;
    
}
.social:hover {

    background-color: rgb(118, 118, 118);
box-shadow: 0px 0px 2px 3px rgba(125,125,125,0.75);
    color: rgb(255,255,255);
    
}

.social:hover a {
    color: rgb(255,255,255);
}
a {
    color: rgb(20, 0, 255);
    transition: color 0.5s;
}

a:hover {
    color: rgb(0, 255, 10);
    text-decoration: underline;
    
}
<div class="social"> <span>Blank</span>  <br> <span> Blank</span> <p> <a href="http://www.twitter.com"> Hello <i class="fa fa-twitter"></i></a> <a href="http://www.facebook.com" target="_blank"><i class="fa fa-facebook-official"></i></a> <a href="http://www.plus.google.com" target="_blank"><i class="fa fa-google-plus"></i></a> <a href="http://www.instagram.com" target="_blank"><i class="fa fa-instagram"></i></a></p> </div>
When hovering over the div, it turns gray with white text, achieving the desired effect. However, I'd like the links to turn lime green when hovered over.

Many thanks in advance!

Answer №1

Adjusted the provided example.

Make sure to include the hover effect on the <a> tag when hovering over the div element

.social {
background-color: rgba(150,150,150,0.75);
height: 150px;
width:200px;
margin: 20px;
display: inline-block;
    transition: background .25s ease, box-shadow 0.20s ease-in-out, color 0.20s ease;
    font-weight: bold;
    
}
.social:hover {

    background-color: rgb(118, 118, 118);
box-shadow: 0px 0px 2px 3px rgba(125,125,125,0.75);
    color: rgb(255,255,255);
    
}

.social:hover a {
    color: rgb(255,255,255);
}
.social:hover a:hover {
    color: rgb(0, 255, 10);
}
a {
    color: rgb(20, 0, 255);
    transition: color 0.5s;
}
<div class="social"> <span>Blank</span>  <br> <span> Blank</span> <p> <a href="http://www.twitter.com"> Hello <i class="fa fa-twitter"></i></a> <a href="http://www.facebook.com" target="_blank"><i class="fa fa-facebook-official"></i></a> <a href="http://www.plus.google.com" target="_blank"><i class="fa fa-google-plus"></i></a> <a href="http://www.instagram.com" target="_blank"><i class="fa fa-instagram"></i></a></p> </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

What is the best way to align a div block with images horizontally?

Trying to center a block of images horizontally, but struggling to get the alignment right. The HTML code looks like this: <div id="dealerarea"> <div id="dealercards"> <!--Images by Javascript--> </div> </div> He ...

After the final breakpoint is reached in Firefox, min-width for Bootstrap 4 element increases to over 17 million pixels

When implementing my Magento 2 theme, I encountered an unusual bug while using Bootstrap 4. If I adjust the device width to 575, certain elements on the page inexplicably expand to almost 20 million pixels in width. Interestingly, this issue only arises i ...

The background is obscured from view because of its current positioning

The issue I am facing is that the background color of the <ol> list is not showing correctly. This problem arose after I floated the label to the left and the input to the right. How can I resolve this? The desired outcome should be: My current resu ...

Is there a way to create a scroll down and scroll up button that is located outside of the scroll box

A game designer challenged me to create a custom scrollbar with unique up and down button styles, as well as a custom-looking scrollbar. I wanted to achieve this without using the native browser scrollbar on Windows in Google Chrome. https://i.sstatic.net ...

How can I make a Bootstrap video embed fill the entire width of the screen?

I'm struggling to integrate a YouTube video into my webpage with Bootstrap, but I want it to span the entire width of the page. Here's the HTML code: <iframe class="embed-responsive-item youtube" src="https://www.youtube.com/em ...

Is there a way to hide the borders between cells within these divs?

I am working on an application screen using Vue.js and facing an issue with the divisions between cells. I want to hide these divisions so that the lines of the items appear continuous. I attempted to modify the classes of the columns to "col-md" and "col ...

Suggestions for showing an error message when a field is empty and the user moves on to the next one

When a user begins typing a password without entering their email address first, immediately display the message - “Please Enter Your Email Address First”. My project utilizes bootstrap4 and jQuery/Javascript. I need the cursor to move to the field whe ...

Tips for troubleshooting a sass file that is not displaying changes in the browser

Currently working on my portfolio website using bootstrap and sass along with a theme kit. Initially, I attempted to implement a grid column style for the intro-section but had a change of heart and deleted the style. Surprisingly, every time I refresh my ...

What is the best way to assign a percentage width based on a variable in jQuery?

Is there a way to assign a dynamic width value to an element? Here is the code I am using: $(".menu_list_item").css({ width: width + "%" }); Unfortunately, this doesn't appear to be functioning correctly. If anyo ...

Guide to positioning multiple <img> elements within a single <div> container

I'm having trouble aligning these 6 images inside a div using CSS. They are currently aligned vertically, but I want them to be side-by-side. div#menu-lixos img{ margin-left: auto; margin-right: auto; ...

Wrapping Text around an Image in HTML

I am currently in the process of designing a website using the flexible box model. My main challenge right now is trying to align text to the right of an image, and then below it. I've attempted using float:right/left along with align="left/right", bu ...

Implement a fade-in animation with opacity on the background image when the page is loaded

Is there a way to create a background image that fades in from invisible opacity to 50% opacity and remains there using only CSS, without any JavaScript? I came across a similar question on Stack Overflow, but the solution seemed too complicated for me. Pe ...

The issue with MUI createTheme lies in its failure to correctly communicate the theme to MUI components

After setting up a theme for my React.JS project using MUI in the index file, I encountered an issue when trying to style the Appbar. The theme does not seem to affect the menu button or the menu itself. The button appears as the default generic style, and ...

The footer on my webpage seems to be completely incorrect, but I'm struggling to identify what is causing the conflict

I'm puzzled by the issue with the footer on my webpage, especially the strange line of black opacity that shouldn't be there. I'm unsure why this is occurring. You can view the problematic page here. I've also created a codepen with the ...

What are the steps to achieve the desired PrimeFaces theme appearance for selectOneMenu?

Need help with a JSF Primefaces project using the omega theme. The selectOneMenu dropdowns are not displaying correctly (missing line). Current look: https://i.stack.imgur.com/vF4ms.png Expected look: https://i.stack.imgur.com/hXsIB.png Any suggestion ...

The .on() function in Jquery seems to be malfunctioning when it comes to handling dynamically

Despite my efforts to find a solution after exploring other questions and attempting various possible fixes, I am still unable to correctly bind the click event. Any assistance would be greatly appreciated. My current project involves a webpage that intera ...

When creating a PDF from HTML using iText, the CSS styling is not applied

Even though I am able to generate a PDF from an HTML string, the issue is that it doesn't apply the CSS styles. How can I create a PDF with CSS styling? Please assist! I have already attempted using CSSResolver. Below is my code snippet: {String res ...

Having Trouble with the Spacing Between Navbar and Page Content in Bootstrap?

Let's tackle the issue at hand: Here is the code snippet. A lot of it has been borrowed from examples and tutorials. <!-- Navigation --> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <!-- Brand a ...

How do I incorporate a responsive image within a bootstrap grid while ensuring it fits correctly?

The code I wrote: <div class="row"> <div class="col-md-9"> <img src" link "> </div> <div class="col-md-3"> <form> </form> </div> ...

Performing PHP MySQL table database insertion utilizing the $_GET approach using Codeigniter-3 and Dropzone-4.1 plugin

Currently working with CodeIgniter 3 and running into an issue with "id_case" showing as undefined index. When I click a link in index.php: <?php echo "<td><a href='/ci_dropzone/?id_case=".$row['id_case']."'>Upload File ...