Updating background image of subclass with hover effect in CSS

Here is the code I have for a tab that can be selected:

<div class="tabOff">
   <div class="lightCorner TL"></div><div class="lightCorner TR"></div>
   <div class="cornerBoxInner">
      <p>My Tab</p>
    </div>
</div>

When the mouse hovers over tabOff, the background color changes using the following CSS:

.tabOff:hover
{
    background:#AAA;
    color:#CDEB8B;
}

I am wondering if there is a way to change the background image for the classes "lightCorner TL" and "lightCorner TR" without using JavaScript, when tabOff is hovered.

These are the current CSS styles for lightCorner TL and TR:

.lightCorner
{
    background:url(../Images/LightCorner.gif) no-repeat;
}
.TL
{
    top:0px;
    left:0px;
    background-position:0px 0px;
}
.TR
{
    top:0px;
    right:0px;
    background-position:-13px 0px;
}

Answer №1

This method is new to me, but my initial approach would be:

.tabOff:hover .lightCorner {
}

Not entirely sure if this is the right way to use it.

Answer №2

.tabOff:hover div.lightCorner {
  background:url(../Images/LightCorner.gif) no-repeat;
}
.tabOff:hover div.TL {
  top:0px;
  left:0px;
  background-position:0px 0px;
}
.tabOff:hover div.TR {
  top:0px;
  right:0px;
  background-position:-13px 0px;
}

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

Click on a thumbnail to open the gallery

I am currently working on implementing a feature that will allow a gallery to open when a thumbnail is clicked. At the moment, the code I have looks like this: <div class="row"> <div class="col-lg-12"> <h1 class="page-h ...

How can I use JavaScript or CSS to identify the specific line on which certain words appear in the client's browser?

Imagine I have the following HTML structure: <div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco labor ...

Replace jQuery CSS with standard CSS without using !important to override styles

Recently, I encountered a puzzling situation: I have an element with the following CSS properties ($(this) represents the cloned object): clone.css({ 'width': $(this).width() + 'px', 'height': $(this).height() + ' ...

Ways to adjust the height of a Vuetify v-autocomplete listbox (results area) through CSS

I'm looking to adjust the height of the Vuetify v-autocomplete component, which is currently set at 304px (possibly a calculated value). <v-autocomplete class="flex-grow-0 ml-16 mr-6 largecontent" prepend-inner-icon="mdi-magn ...

Methods for Automated Testing of ASP.NET 2.0/ADO.NET Software Development

Could you recommend some strategies for testing a complex ASP.NET 2.0 solution, such as a large website with multiple dependent assemblies (including App_Code)? Specifically, I am interested in testing the functionality of web pages. Do you think web cont ...

Minimize the empty area separating two adjacent <sup> components

Here is the code snippet I am working with: <p>Test <sup>1</sup> <sup>, 2</sup> </p> The output of this code is "1 , 2". I am having trouble applying styles to the sup elements, as there are no margins or paddings ...

How can I load only specific images on a webpage using HTML?

I attempted to implement an image filter for my website by using the code below: <script> function myFunction() { // Initialize variables var input, filter, ul, li, a, i; input = document.getElementById('myInput'); filter = input.value.toU ...

Is it normal for ASP.NET Control to return null with JavaScript getElementById?

When I am using JavaScript, I encounter the following error during execution: Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object This is the code I am working with: <asp:Content ID="content2" ContentPla ...

What is the best method for deleting an uploaded image from a box?

My code is quite lengthy, so I'll just showcase the JavaScript portion here. Here is a snippet of my JavaScript code: <script type="text/javascript"> let current = 0; for(let i = 0; i < 5; i++) { $('#thumbnail-view- ...

Numerous toggles available for the mobile version

Hey there, I need some help! I have a footer navigation on my desktop website with 3 Ul elements. I want to turn each Ul into a toggle for the mobile version. Can anyone assist me with this? Thanks in advance! <footer class="footer"> <d ...

Troubleshooting Time Drop Downs and AM/PM Problems in ASP.NET

While I have already looked for solutions to my issue, most of the answers were too focused on code rather than considering usability and human-computer interaction: https://stackoverflow.com/search?q=[asp.net]+time+am+pm The dilemma lies in having an ev ...

Is it possible to modify or delete the question mark in a URL?

Currently, I am working on implementing a search bar for one of my websites hosted on Github. Below is the code I have written for the search bar: <!-- HTML for SEARCH BAR --> <div id="header"> <form id="newsearch" method ...

Modifying the color of the accordion icon in Bootstrap 5.3 by utilizing a root variable

Is it possible to change the icon color of Bootstrap 5.3's accordion component to match the color of the heading text? I have successfully set the heading text color using a CSS root variable var(--body-text). However, when trying to override the SVG ...

The footer of the website remains separate from the overlay of the modal Popup Form

I recently implemented a modal popup form on my website that covers the entire viewport with its background. However, I am facing an issue where the footer of the website is still displayed on top of the modal background, even though everything else seems ...

Tips on adjusting video to the screen size

I am looking to create a fullscreen video for my webpage. I originally used an image as a cover, but now I want to switch to using a video. You can check out my old code on this link. Below is my new video code: <div class="embed-responsive embed-resp ...

Using CSS to create a color combination of black with varying opacities

I attempted to achieve a black color by blending together the colors red, yellow, and blue in CSS, but encountered an issue... Is there a way to create black color using opacity? ...

Is it possible to invoke a Java Script function from a GridView using `<% Eval("") %>` as a parameter for the function?

Is there a way to call a javascript function with a single parameter from a link click within the GridView Control? I need to pass the value of the parameter using <%Eval("myfield")%>. How can this be accomplished? <ItemTemplate> ...

What is the trick to having the ball change colors every time it hits the wall?

Recently, I stumbled upon this interesting ball bouncing question while searching for some JavaScript code. While the basic bounce animation was simple to achieve, I started thinking about how we could make it more dynamic by changing the color of the ball ...

Begin one lesson, end all others

Looking for help with my expandable list menu that I created using jQuery. Here is the code snippet: $("#menu ul li ul").hide(); $("#menu ul li").click(function() { $(this).find("ul").slideToggle(); }); You can view the fully functional menu on jsFi ...

Tips for setting the height of a div within a td to be 100%

I am struggling to make the orange divs in this example stretch out to match the height of the enclosing td element without explicitly setting the parent's height. I have tried using display: flex and align-items: stretch, but I can't seem to ach ...