Implementing hover CSS transition for a div positioned behind another div that serves solely as text

I am currently working on a website and trying to replicate the design of a Wordpress site I created. However, the Wordpress site is very slow, so I am only recreating certain elements of it.

You can view the original website at . One of the features I recreated on my new site is the 3 boxes with product images and text inside them. You can also check out the code for this feature on CodePen http://codepen.io/anon/pen/Qyxxbp.

<section id="portfolio">
<div class="container-fluid nopadding">
             <div class="row nopadding">

                   <div class="col-lg-4 nopadding image">
                        <img class="imgwidth" src="img/11.jpg" alt="" />
                                <div class="absolute text-center">
                                    <span> lol </span>
                           </div>
                   </div>
                <div class="col-lg-4 nopadding image">
                    <img class="imgwidth" src="img/22.jpg" alt="" />
                        <div class="absolute text-center">
                                <span> lol </span>
                        </div>
                </div>
                <div class="col-lg-4 nopadding image">
                    <img class="imgwidth" src="img/33.jpg" alt="" />
                        <div class="absolute text-center">
                                <span> lol </span>
                        </div>
                </div>

        </div>
    </div>
</section>

In order to position text over the <img>, I used relative positioning for the img and absolute positioning with top: 0px for the text div. The only issue I encountered was that when I set the text div's height to 100%, it covered the hover area of the image. Do you have any suggestions on how to work around this? I read about using javascript for transitions, so I might explore that option.

Additionally, I noticed a thin black line appearing between the second and third image boxes when hovering over them. Any ideas on why this happens?

Answer №1

Enclose both elements in a separate div and rely on the parent's hover effect to switch out the image.

Another option is to designate the text div as the parent of the image and utilize its hover state for direct control.

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

Arrange list items in an unordered list (ul) side by side

I need to display two child unordered lists side by side. They both have the class names L and R. Here is the relevant section of the HTML markup. <ul class="SearchResult"> <li class="Pagination"> <a id="lnkPageNumber_top_1" class="ACTIVE" ...

Bottom div refuses to adhere to the bottom of the page

I need help with creating a footer div that sticks to the bottom, left, and right of the page. The current footer doesn't extend all the way down and left. How can I resolve this without using "position: fixed;"? Below is the code snippet (I have rep ...

Guide to creating a hierarchical menu with 3 levels in WordPress using the function "wp_get_nav_menu_items"

Struggling to properly display a 3-level hierarchical menu in WordPress using the wp_get_nav_menu_items function. The structure is not rendering as expected. Included below is the code in my header file that I am working with, but it seems like the struct ...

Position the label to the right and left of the input field for alignment

I've been struggling to create an input form with labeled using a dl, dt, dd list. I want the first label on the left, the second on the right, and the input in the center. However, no matter what I try, I can't get the second label to align corr ...

Creating a unique CSS style sheet tailored specifically for Internet Explorer and Microsoft Edge – here's how!

Struggling with internet explorer acting up and causing glitches on my website? Check out my problem here. The Issue: An interactive image on my website is not functioning properly in IE & Edge. The image should expand when hovered over, but glitches ...

Having trouble with Angular 5 build due to issues with adding the bootstrap css file?

I have developed an application using angular 5, integrated ng-bootstrap, and now trying to link the bootstrap css file from node_modules: ../node_modules/bootstrap/dist/css/bootstrap.min.css. However, upon running the ng build command, I encountered the f ...

Make sure to validate a form when submitting from an external source rather than through an HTML

In my form, there are various input fields (some acting as inputs even if they're not). Each field is validated upon submission by angular validation and html attributes like required, ng-maxlength, minlength, etc. Now, we want to implement a keyboar ...

When attempting to organize the layout of the dash app using app.layout=dbc.Container(), an AttributeError occurs, indicating that the 'layout' attribute is not available in the 'tuple' object

I am facing an issue with the script I have: import dash import pandas as pd import numpy as np import database from dash import Dash, dcc, html import dash_bootstrap_components as dbc # create a dash app that is mobile-friendly app = dash.Dash(__name__, ...

View the user's ID profile

Having trouble accessing user profiles? For example, as User 1, you want to view User 2's profile but when entering the URL (e.g. localhost/$userID), only information from your own profile (User 1) is displayed. Below is the HTML CODE for displaying ...

Encountering Trouble Opening PDF File Created via POST Request

I am trying to retrieve a PDF file by sending a POST request to an API URL. $.ajax({ url: "http://ourDevEnv.com:5000/api/v1/Docs/Process", type: "POST", data: printData, crossDomain: true, contentType: "application/json; charset=UTF-8", ...

Effective techniques for managing PHP forms within HTML and CSS by utilizing checkboxes:

I'm struggling with my code, particularly the form section. Here is the HTML code snippet: <form action="index.php/homepage/deleteSelected" method="POST"> <input type="submit" value="Delete Selected"> ...

Tips for verifying the accuracy of a user's input in a quiz

How can I validate a user's input in a quiz scenario? Imagine a quiz where users have to guess the origin of a food item based on an image displayed. If the first picture is from Turkey, followed by Greece, India, and Mongolia, how can I verify if th ...

Filtering arrays using Vue.js

I have developed a sample e-commerce website to showcase various products to potential customers. The website boasts features like filters, search functionality, and sorting options to enhance the user experience. However, I've encountered an issue sp ...

Prevent CSS3 columns from reverting back to their original state after being rendered

Utilizing css3 columns, I have created a layout with an unordered list displayed in 3 columns. Each list item contains another list that can be toggled to show or hide by clicking on the title using jQuery. The structure of the html is as follows (with ex ...

What initiates the call for CSS?

During his instructional video, the creator visits the CodeIgniter website at . When he initially arrives at the site (at 1:32), it appears somewhat odd, almost as if it lacks CSS styling. However, after refreshing the page (1:37), it displays properly. ...

Handling incoming JSON objects from an AJAX call

Something strange is happening. I'm currently using PLUpload and within its onComplete function, there's a variable called info. Take a look at what it shows in Chrome Dev Console: Object {response: "[{"id":"65","series":"","part":"","title":"", ...

Is there a way to determine if a collapsed navbar is currently open?

My Bootstrap 4 navbar collapses on mobile, and I'm looking to detect when it opens and closes. Is there a way to achieve this? Thank you! ...

Styling your website's checkout process

Check out this snippet of HTML code: <div class="footer-address"> <section>Section 1 content</section> <section>Section 2 content</section> </div> I am looking to convert these sections into a two-colu ...

The Angular overlay panel remains open consistently

I recently developed an Angular component similar to p-overlaypanel, but I'm facing an issue where it remains open for every item I click. What I actually want is for only one overlay panel to be clicked and shown at a time - if I click on another ove ...

calculating the size of a list in real-time within an iteration function

I am currently working on obtaining the size of a list within an each loop as there are multiple lists dynamically added. However, I am encountering an issue where it is not returning the correct number. The count should reflect the number of list items p ...