Is it possible to implement a hover animation within another hover animation in WordPress?

Trying to incorporate two hover animations for the images in my photo galleries. When hovering over an image, I want a text to appear in a black overlay, and then when hovering over that text, it should become underlined. Looking for something similar to this example: https://i.stack.imgur.com/vAWpd.jpg I understand that I need to create a hover element, but dealing with nested animations is proving to be complicated. Any guidance or tips would be greatly appreciated. Thank you! Rowan

Answer №1

Do you mean something like this example?

Here is the HTML code:

<div id='cake' src='http://www.cakeisgreat.org/images/slice.jpg'><p id="pInfo" style='left:60px; top:50px; position:absolute;'>Info</p></div>

CSS code:

#cake
{
    width:600px;
    height:300px;
    background-image:url('http://www.cakeisgreat.org/images/slice.jpg');
}

#pInfo
{
    display:none;
    transform:rotate(45deg);
    border:1px solid;
}

#pInfo:hover
{
    text-decoration:underline;
}

#cake:hover > #pInfo
{
    display:block;
}

The information is initially hidden and will only appear when you hover over the div with an ID of cake. The CSS selector > targets elements that are children of cake. It changes the paragraph's visibility from display:none to display:block when you hover over the image. With #pInfo:hover, the text underlines when hovering over the paragraph.

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

Incorporate a dynamic form into an ngx-sortable control in Angular 6

Having difficulty with the layout implementation in Angular 6. A form component is dynamically added during runtime. Using ngx-sortable, I aim to have dynamic content within it, but am facing challenges with the setup. Implementing Sortable control: &l ...

Troubleshooting jQuery masonry problem related to initial display and height settings

Within a div, there is a masonry container with the inline style property display:none. With several divs on the page, clicking their respective buttons during load causes them to switch like a slideshow. This disrupts masonry's ability to calculate t ...

Determine whether the color is a string ('white' === color? // true, 'bright white gold' === color? // false)

I am facing an issue with multiple color strings retrieved from the database. Each color string needs to be converted to lowercase and then passed as inline styles: const colorPickerItem = color => ( <View style={{backgroundColor: color.toLowerC ...

forming a boundary that stands alone, unattached to any other boundaries

I am trying to design a navigation bar that resembles the one depicted in the image provided. The concept involves creating a navigation bar where each border is separated from the others, potentially achieved using hr tags. However, I am struggling to fi ...

The toggle checkbox feature in AngularJS seems to be malfunctioning as it is constantly stuck in the "off"

I am trying to display the on and off status based on a scope variable. However, it always shows as off, even when it should be on or checked. In the console window, it shows as checked, but on the toggle button it displays as off Here is the HTML code: ...

Submitted input in a text field is automatically displayed in a separate text box

Below is a snippet of HTML code from my AngularJS application <input type="text" class="input-xlarge" id="user_name" ng-model="myModel.text" name="user_name" rel="popover" data-content="Enter your first and last name." data-original-titl ...

CSS Flexbox: Achieving Perfect Alignment for a Responsive Hamburger Navbar

This is a specific inquiry that requires your attention To begin, kindly execute the code in fullscreen mode Inspect the code and adjust it to fit within a mobile width (there seems to be an issue with responsiveness) Next, open the hamburger menu As show ...

Utilize npm libraries within the main directory of Sage 8.5.3 theme

When attempting to add npm libraries in the root of Sage 8.5.3, I encountered an error in the console stating that 'require' was not found. var GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(goo ...

Converting CSS to LESS with multiple classes sharing the same properties: step-by-step guide

I have some CSS code here that I'd like to convert into LESS format. Can you help me with that? .A .B h4, .A .B h4 a, .A .C h4, .A .C h4 a, .D h4, .D h4 a { color: #345e8a !important; display: inline-block; font-family: @font-family-sans ...

html pagination on website

I am currently displaying my products in rows, however the code I'm using is presenting them in columns instead. I have implemented a datatable pagination feature, but I'm struggling to understand how to properly use it on my website. Can someone ...

splitting up the lengthy list into manageable chunks according to the screen dimensions

How can I make the blue color row-based list (the divs inside a div with id phrase) break on the next line based on the screen size? Any suggestions on additional changes needed in the following CSS? #phrase { color: #fff; position: ...

Ever thought about harnessing the power of SassDoc to create detailed documentation for your sass

After experimenting with sassdoc for documenting our sass mixins and functions, I realized that there doesn't seem to be a straightforward way to generate documentation for our sass variables. Specifically, I am looking for a solution that can output ...

Is there a way to specifically target the parent input div using event delegation with jQuery?

I'm having trouble inserting values into the input fields for Item Name and Description. See the HTML code below. <div class="input_fields_wrap"> <div class="input_fields_subwrap"><!-- this div is repeatable(dynamic form)--> ...

Breaking the line within a text area field

Currently, I am working on a PHP form that includes a textarea where users can input data. This data is sent to the script using $_POST and then stored in a database. One issue I have encountered is that if a user populates the textarea but does not press ...

Steer clear of using grey backgrounds for anchors/links in IE 10

What is the best way to prevent the irritating grey background that appears on anchors in IE 10 when they are clicked? ...

What is the best way to eliminate the Mat-form-field-wrapper element from a Mat-form-field component

I have implemented Angular mat-form-field and styled it to appear like a mat-chip. Now, I am looking to remove the outer box (mat-form-field-wrapper). <div class="flex"> <div class="etc"> <mat-chip-list i18n-aria-lab ...

What is the best way to position a popup div in CSS?

Currently, I am in the process of developing a website that displays DVD details when hovering over an image, similar to what is shown in picture 1. However, I've encountered an issue where the content gets cut off for DVDs located on the right side o ...

Utilizing Angular's directive-based *ngIf syntax instead of passing a string parameter

Currently, I'm studying the article on reactive forms by PluralSight to brush up on my knowledge and I'm having trouble understanding the syntax provided below. <div *ngIf courseForm.get('courseName').valid && courseForm.get ...

Rotating through elements in timed intervals

After exploring various examples of how to show/hide divs with a JavaScript timeout, I am still unable to resolve my specific issue. I currently have six divs that I want to cycle through sequentially every 10 seconds, starting with div #one. Although my ...

What is preventing the addition of links to the navigation bar when using a sticky navigation bar?

Currently, I am in the process of developing a blog website using Django. One of the features I have successfully implemented is a sticky navigation bar. However, I am facing a challenge with adding links to the menu on the navigation bar due to existing ...