I am having trouble viewing my icons properly displayed in front of my buttons in HTML and CSS

I've been working on creating a background that, when hovered over, reveals 2 buttons with different icons on them. I'm trying to change the color of these icons from black to white using CSS.

However, I'm facing an issue where I can't see the full icons in front of the buttons.

You can view my code here: http://jsfiddle.net/72XyL/225/

Html:

<div class="show-image">
    <div onclick="window.open('http://www.google.co.uk','mywindow');" style="cursor: hand;" class="update">
        <div class="img"></div>
    </div>
    <div onclick="window.open('http://www.google.co.uk','mywindow');" style="cursor: hand;" class="delete">
        <div class="img"></div>
    </div>
    <img src="http://www.doylecollection.com/var/doyle/storage/images/media/photo-galleries/the-dupont-circle-hotel-gallery/rooms/dupont-circle-hotel-superior-king-room/36016-1-eng-US/dupont-circle-hotel-superior-king-room_gallery_image.jpg" class="background" />
</div>

CSS:

div.show-image {
    position: relative;
    float: left;
    margin: 5px;
}
div.show-image:hover img {
    opacity: 1;
}
div.show-image:hover div {
    display: block;
    opacity: 1;
}
div.show-image div {
    position: absolute;
    display: none;
}

.background {width: 600px;height: 400px;}

.update {
    top: 45%;
    left: 30%;
    width: 25px;
    height: 25px;
    margin-right: 4px;
    background-color: #de543e;
    padding: 16px 18px;
    cursor: pointer;
    opacity: 0.9;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
    border-radius: 80px;
    z-index: 1;
}
.show-image .update .img{
    background-color: #fff;
    -webkit-mask-image: url('http://www.clipartbest.com/cliparts/MiL/LKL/MiLLKLegT.png');
    width: 25px;
    height: 25px;
    z-index: 2000;
}
.show-image .delete .img {
    background-color: #fff;
    -webkit-mask-image: url('http://www.hdwallpapersinn.com/wp-content/uploads/2014/12/black-white-metro-calendar-icon.png');
    width: 25px;
    height: 25px;
    z-index: 2000;
}
.delete {
    top: 45%;
    left: 55%;
    width: 25px;
    height: 25px;
    margin-right: 4px;
    background-color: #de543e;
    padding: 16px 18px;
    cursor: pointer;
    opacity: 0.9;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
    border-radius: 80px;
}

Answer №1

While css masks may not be the most widely supported feature, adding the following CSS to .show-image .img can help solve your issue:

.show-image .img{
    -webkit-mask-position: 0;
    -webkit-mask-size: 24px;
    -webkit-mask-repeat: no-repeat;
 }

This solution takes into account your existing code and is tailored for webkit browsers.

Answer №2

Consider updating your code by utilizing the CSS :before property.

You can try implementing it in this manner: http://jsfiddle.net/72XyL/230/

Answer №3

            div.show-image {
            position: relative;
            float:left;
                        margin:5px;
            }
            div.show-image:hover img {
            opacity:1;
            }
            div.show-image:hover div {
            display: block;
            opacity:1;
            }
             div.show-image div {
            position:absolute;
            display:none;
            }
              .background {
            width:600px;
            height:400px;
              }
             .update {
            top:45%;
            left:30%;
            width: 25px;
            height:25px;
            margin-right: 4px;
            background-color: #de543e;
            padding: 16px 18px;
            cursor: pointer;
            opacity: 0.9;
            -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
            border-radius: 80px;
            z-index:1;
            }
               .show-image .update .img {
            background: url('http://www.clipartbest.com/cliparts/MiL/LKL/MiLLKLegT.png') no-repeat;
            background-size:25px;
            width: 25px;
            height:25px;
            z-index:2000;
            }
              .show-image .delete .img {
            background: url('http://www.hdwallpapersinn.com/wp-content/uploads/2014/12/black-white-metro-calendar-icon.png') no-repeat;
            background-size:25px;
            width: 25px;
            height:25px;
            z-index:2000;
        }
        .delete {
            top:45%;
            left:55%;
            width: 25px;
            height:25px;
            margin-right: 4px;
            background-color: #de543e;
            padding: 16px 18px;
            cursor: pointer;
            opacity: 0.9;
            -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
            border-radius: 80px;
        }

http://jsfiddle.net/mynameisvikram/72XyL/236/

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

Tips for transferring a value from a function in ASPX to a CS file

I seem to be overlooking a small detail. I have a dropdown list (DDL) and a function in my C# file. I want to pass the 'value attribute' of a selected DDL option to my function, but I can't seem to retrieve the value attribute. I checked the ...

The ongoing battle between Carousel full page image slider and multi div slider in Bootstrap 4

I need a full-page carousel image slider in one div container and a multi-div slider in another div container on my homepage. Unfortunately, due to some conflicting class names (such as carousel slide, carousel-inner, etc.), they are interfering with each ...

Tips for resolving CSS issues in a vast style sheet

I'm currently facing a challenge with modifying the CSS of a Wordpress plugin I need to utilize. The learnpress.css stylesheet is very extensive, spanning over 2000 lines, making it quite complex to comprehend. All I am trying to achieve is a simple t ...

Display webpage content in an Iframe using Javascript after PHP code has been executed

Despite researching keywords like PHP // Javascript // Load // URL online, I'm still struggling to fully grasp the concepts. Real-life case studies have been helpful, but I must admit that I'm feeling a bit overwhelmed at the moment. I created a ...

Prevent unwanted padding in lists by using CSS float inside

When organizing my list element, I want to position the control buttons next to the left of the list item text. To achieve this layout, I have applied the CSS property float: left;. However, a problem arises when there are multiple lines in a list - each n ...

Styling the shadow of Bootstrap 4 tooltip arrows

Below is the arrow of the tooltip without any shadow effect: https://i.sstatic.net/8gmO1.png I've been attempting to add a shadow effect to the arrow, but due to its border-based nature, I haven't achieved the desired outcome. The current rende ...

Utilizing Jquery for independently blinking text counters

Whenever the user presses a button, a message is created and blinks 5 times. However, each time the button is pressed, all previous messages also blink along with the new one. The goal is to make only the new message blink individually 5 times upon each bu ...

Currently, I am experiencing difficulties with two specific aspects of the website I am working on - the hamburger menu and the slideshow feature

I'm having trouble with the menu on my website. It's not functioning as expected - the dropdown feature isn't working, and two items are not staying in the correct position under the parent ul despite attempts to position them using CSS. Add ...

Obtaining the ROW ID from a dynamically generated table using AJAX in PHP with MySQL and JQuery

As I delve into this little project, I find myself in uncharted territory. Previously, I successfully utilized jQuery to capture ID/values when clicking on table rows, but now I'm faced with a new challenge involving PHP and Ajax. The initial setup in ...

All buttons are uniform in size and not affected by the content

I'm struggling to make all buttons the same size when they contain different content. I'm looking for tips and tricks to better understand this issue. Here is a visual representation of the situation: https://i.sstatic.net/lsiAJ.png Below is the ...

What are your strategies for designing a website specifically for mobile users?

Today, most modern smartphones come with 720p or 1080p resolution screens. This means that even on smaller screens, like a 4-inch display on a Galaxy s3, we can still view all the text and GUI elements (such as email textboxes) on a website when we first o ...

What is the best way to incorporate and organize the templateHyper folder within an established web project directory?

Can anyone offer advice on how to properly integrate and organize the 'templateHyper' (Bootstrap template) folder within my web project? I've been developing a project using C#, JavaScript, HTML, and Bootstrap's templateHyper. I'm ...

Error message occurs when attempting to use the ->num_rows function on inner join statement and accessing a property of a non-object

I am attempting to fetch both Product_Name from the product table and Order_Date from the order table, but I keep encountering an issue at line 35 mentioning the "num_rows line". <?php $servername = "localhost"; $username='root'; $password = ...

Create a shape using a series of points without allowing any overlap between the lines

JS fiddle There is an array of coordinates that gets populated by mouse clicks on a canvas. var pointsArray = []; Each mouse click pushes x and y values into this array using a click event. pointsArray.push({x: xVal, y: yVal}); The script iterates thr ...

Default setting to display modal on page load and prevent it from closing

I've written a JavaScript script to open a Modal on page load using .modal('show'). I also want this Modal to stay open and not close when clicked. I found online that adding .modal({ backdrop: 'static', keyboard: false }) should a ...

Troubleshooting: Issue with detecting keypress using jQuery

Currently, I have a jQuery script that checks password strength and changes an image source based on complexity. The functionality works smoothly within jsFiddle (set to jQuery 1.91), but when implemented on my webpage, the event seems to not be triggered. ...

Utilize the dropdown menu and input form for connectivity in a bootstrap framework

Below is the HTML code I am working with. When you click on the search icon in the top right corner, a dropdown box appears in the opposite corner. I want to align these two elements so that the dropdown box is positioned directly below the search box and ...

Is it possible to locate the storage location of your CSS class in WordPress using the Chrome DevTools?

I need to switch the positions of two tabs on my product page: https://i.sstatic.net/L7xcC.png The Learn More tab should be in place of the Specification tab, but I am having trouble locating the class. I have searched for the class in the style.css fil ...

In the XHTML mode, MathOverflow's invaluable mathematical expertise shines brightly

I am interested in incorporating the unique “piece of valuable flair™” from MathOverflow onto my website. The issue I am facing is that I want my webpage to comply with XHTML5 standards, meaning it should be served with the MIME type application/xht ...

Extract the height of children from the height of their parent

Hey there! I recently discovered a fantastic plugin that helped me achieve equal heights for all the divs on my website. If you're interested, you can check out the plugin here. $('.item-container').responsiveEqualHeightGrid(); However, I& ...