Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On hover fade image and show text #81

Open
GemmieDodger opened this issue Jul 7, 2020 · 0 comments
Open

On hover fade image and show text #81

GemmieDodger opened this issue Jul 7, 2020 · 0 comments

Comments

@GemmieDodger
Copy link

GemmieDodger commented Jul 7, 2020

Hi,

Please can I add a CSS trick to fade out a div with text, that brings text to the foreground. Please see markup below and codepen of effect:

https://codepen.io/gemmiedodger/pen/vYLRzRK

<div class="gallery_product">
    <div class="img-gallery">
        <p class="img-text">WHY IS IT SO RAINY...</p>
    </div>
    <div class="middle-gallery">

        <p class="strokeme">HERE COMES THE SUN</p>    

    </div>
</div>

<style>
    .gallery_product
    {
        margin-bottom: 30px;
        position: relative;
        width:250px;
        height: 250px;
    }

    .img-gallery {
        display: block;
        max-width: 100%;
        background-color: darkslateblue;
        opacity: 1;
        transition: .5s ease;
        backface-visibility: hidden;
        height: 250px;      
        text-align: center; 

    }
    
    
    
    .img-text {
       padding-top: 50%;
       width: 250px;
       color: darkgrey;
       font-weight: bolder;
       
    }
    
    .middle-gallery {
        transition: .5s ease;
        opacity: 0;
        position: absolute;
        top: 50%;
        left: 50%;
        min-width: 250px;
        transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        text-align: center;
        color: yellow;
        font-weight: bolder;
        letter-spacing: 3px;
        font-size: 24px;
        padding: 16px 32px;
        text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;

    }

    .gallery_product:hover .img-gallery {
        opacity: 0.2;
    }

    .gallery_product:hover .middle-gallery {
        opacity: 1;
    }


</style>```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant