bomb

Stack Overflow Love

[email protected] October 23, 2019 11:45 pm

Hello! Thank you for visiting my blog. I am writing this randomly this evening after having yet ANOTHER lovely Stack Overflow moment. Yes, I have had many of these moments when I’ve tried fixing my code myself over & over again – only to finally surrender and “Google” my problem and find my lovely solution on Stack Overflow from a fellow coder that want to help some noobs.

I have a list of blog topics that I want to cover, but have not written on them yet because they are a little more technical in nature and would require me doing research work up front. This evening, I just want to share the lovely solution that I found on Stack Overflow. It is probably nothing spectacular, but it is something that I have not been using in my CSS.

So what I was trying to do was get the background-color of my div to change color on hover and also get the color of my h4 text to change color upon hovering over that div. So here is the HTML that I had written:

<div class=”contact-one”>
<h4 class=”contact-headline”>FOLLOW</h4>
</div>

and my CSS:
.contact-one{
background-color: black;
}
.contact-headline{
color: white;
}

Something I tried:
.contact-one:hover {
background-color: white;
color: black;
}

That didn’t work. I had only the background color changing color after writing this code.

The Lovely Stack Overflow Solution:

.contact-one: hover {
background-color: white;
}

.contact-one: hover .contact-headline {
color: black;
}

And that was it! So….I’d love to hear what you have to say about this! I will write more on this in my next post! Stay tuned!




Leave a Reply

Your email address will not be published. Required fields are marked *