What is the best way to create a functional menu placed behind a PNG image using CSS?

Looking to add a PNG image to a menu, similar to the one showcased below:

https://i.sstatic.net/YOXpM.jpg

My current approach involves using position: absolute and z-index, but I'm encountering issues when the menu ends up behind the PNG image. Is there a way to create a mask from the PNG image so that the menu functions properly within that area?

Answer №1

One option is to keep the image as it is and simply add this CSS style to it:

img {
  pointer-events: none;
}

The downside is that this approach may not function properly in Internet Explorer 10 and earlier versions.

http://caniuse.com/#feat=pointer-events

Answer №2

Consider using an image to mask your menu, as shown below:

<div id="menu">
    <!-- insert your menu items here -->
</div>

Custom CSS code:

#menu{
        width:your_menu_width;
        height:your_menu_height;
        -webkit-mask-image: url(image_path.png);
        -o-mask-image: url(image_path.png);
        -moz-mask: url(image_path.png);
        mask-image: url(image_path.png);
}

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

Maintain visibility of Bootstrap side menu

I noticed on the Bootstrap website there is a sidebar with sticky links that stay in view as you scroll. They also highlight each menu item when it's in view. I've tried replicating this on my own website, but can't figure out how to make it ...

Create dynamic div animations triggered by changes in size of another div

Struggling to get this animation to function correctly. I have a vertical scrolling page with various sized div elements that change based on the content. The problem is that when these size changes occur, the other elements are moving abruptly. I want to ...

The folder could not be located by MAMP

For years, I've relied on MAMP to manage my web development projects. However, after performing a clean install of my Mac recently, I reinstalled MAMP only to encounter issues with it not functioning properly. Upon reinstalling the program and placin ...

"Troubleshooting: Issue with ng-click in AngularJS not triggering ng-show

I can't figure out why my ng-click isn't showing the ng-show message. I've tried searching for a solution but no luck. Here is my controller function: $scope.showLogoutMessage = function() { $scope.logoutmsg = true; }; This is my Logi ...

Transferring information from an HTML form to a C# webservice through AJAX

I've created a form in HTML using Bootstrap within PHPStorm, and now I want to send the information to a C# webservice using AJAX. However, I'm unsure about what to include in the AJAX URL section (shown below). Here is the HTML/Bootstrap form I ...

What is the best way to display multiple HTML files using React?

Looking to develop a web application using React that consists of multiple HTML pages. For instance, login.html and index.html have been created and linked to URIs through the backend - resulting in localhost:8080/login and localhost:8080/index. However, R ...

Issue encountered while retrieving the initial element using .parent().search('img').eq(0)

I'm trying to extract an 'img' element inside an 'a' tag, but unfortunately, I'm having trouble achieving this. Here is the HTML code: <table class="table table-bordered"> <thead> <tr> ...

The alignment of the Unicode character is off and is not centered within the button

Upon implementing a unicode character as a button, I've observed that the alignment of the character is not centered properly (both horizontally and vertically) within the button. It's puzzling why this misalignment occurs even after setting padd ...

Troubles with Bootstrap's column functionality causing issues

Trying to create a menu using Bootstrap, but experiencing issues with the 'col' class not working correctly. Here is the sample HTML code provided: <div class="logo col"> <a href="index.html"><img src="C ...

Hovering over an image will not cause the floating header to appear

My attempt to create a header that fades with scroll and appears on hover is working perfectly, except for the cat pictures in the Portfolio section. Despite adjusting z-indexes and trying various solutions, the header just won't show up over the h4 e ...

Implementing the Upload Feature using AngularJS

Currently, I'm facing a challenge in implementing an upload button on my webpage using AngularJS and Bootstrap. Specifically, I am having trouble assigning the (upload) function to that button in AngularJS. The goal is for the button to enable users t ...

Completely shrink the middle row first when resizing the browser before shrinking the other rows

Utilizing a simple three row structure: <div class="EditorHeaderWrapper"> <h1>Title</h1> </div> <div class="EditorMainRowWrapper"> // Content of the main row goes here </div> <div class="EditorFooterWrapper"> ...

Horizontal JQuery Slider for CategoriesDiscover the smooth, sleek category navigation with

Looking to create a sliding horizontal menu with various categories using a clever div layer setup. The goal is to have one fixed-width div containing another wider div, with only a portion of the second one visible at a time. Encountering two challenges ...

Center the navbar menus at the bottom

Trying to position two menus on a webpage can be challenging. One needs to show at the center bottom, while the other should appear in the top right corner. When attempting to achieve this layout, it's important to ensure that both menus are displayed ...

Obtain the title of the text generated by clicking the button using a script function

I am working on a piece of code that generates a text box within a button's onclick function. My goal is to retrieve the name value of each text box using PHP. <script language="javascript"> var i = 1; function changeIt() ...

Slider Footer Player for Rdio

I am currently working on replicating the interactive player footer design used by rdio (). When you click on the footer, a panel elegantly slides up to reveal additional content. Another example of this functionality can be seen on the website teehan lax; ...

Modifying CSS property values by handling a returned validation error

Allow me to describe a scenario I've created. Please excuse any language errors in my explanation. I have designed a form for users to submit values. Within this form, users can choose an option - one of which is "Others specify...". When this option ...

What is the best method for incorporating a unique style to a v-dialog component in Vuetify following the most recent update?

I'm currently working on a project using vuetify, and I am facing an issue while trying to add a custom class to a v-dialog component. I have tried searching for information on how to do this, but it seems that the prop "content-class" has been deprec ...

Incorrect Alignment of CSS Menu Popout

I am currently working on designing a stylish menu that expands to display the available options, but I am encountering challenges with the CSS. Specifically, I am struggling to make the sub-menu pop out from the city name seamlessly. CSS ul { margin : 8 ...

Searching for a post by content or title on Flask can be done by utilizing the search functionality built

I've created routes and forms, but when I tried to search, it showed "cannot be found." Here is my code: routes.py: @app.route('/search',methods=['GET','POST']) def posts_lists(): q = request.args.get('q') ...