Tips for inserting a pin into a designated location on an image map

Within my angular application, I have implemented an image map using the HTML usemap feature.

Here is the code snippet:

<img src="../../assets/floor2.jpg" usemap="#floor2Map">
        <map name="floor2Map">
            <area shape="poly" coords="210,340,216,234,312,236,323,323,317,346" matTooltip="Info about the Device" >
            <div id='pin-1' class="box" >
                <div class="pin-text">
                    <h4>My Device</h3>
                </div>
            </div>
        </map>

In the CSS file:

.box:hover > .pin-text {
        display: block;
    }

    .box {
        width:8%;
        height:8%;
        background-image: url('http://www.clker.com/cliparts/W/0/g/a/W/E/map-pin-red.svg');
        background-position: top;
        background-repeat: no-repeat;
        background-size: contain;
        position: absolute;
    }

    .pin-text {
        position: absolute;
        top:50%;
        transform:translateY(-50%);
        left:75%;
        white-space:nowrap;
        display: none;
    }

I am looking to place a pin on a specific area of the image and display a tooltip when hovered over. However, currently the SVG icon appears below the image.
Here is the SVG for your reference -

Answer №1

.cube {
    top : 260px ;
    left : 210px;
    width:8%;
    height:8%;
    background-image:   url('http://www.example.com/image1.jpg');
    background-position: top;
    background-repeat: no-repeat;
    background-size: contain;
    position: absolute; 
  }

The problem has been resolved by incorporating top and left positioning.

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

There seems to be a glitch in my JavaScript for loop as it is not iterating for the correct amount that it should

It seems like my for loop is not always iterating 7 times as intended. Sometimes it runs with 5 iterations, other times with 4 or 3. This is the JavaScript code I am using: var start = new Date().getTime(); var end = new Date().getTime(); function timeT ...

Error: Attempting to access the 'pipe' property of an object that is undefined in the context of Jasmine and Angular

I'm encountering an issue with unit testing in Angular. Specifically, I'm getting a TypeError: Cannot read property 'pipe' of undefined when trying to test the output of an observable subscribe function. Any assistance on resolving this ...

Creating Radial Fades with CSS3

Seeking guidance on creating a background similar to the one shown here using just CSS. I believe it can be done, but I struggle with CSS3. The goal is for the background to be compatible with all modern browsers, not overly concerned about support for br ...

What is the best way to ensure consistency in a value across various browsers using Javascript?

I am currently developing a feature on a webpage that displays the last update date of the page. The functionality I am aiming for is to select a date in the first input box, click the update button, and have the second box populate the Last Updated field ...

Can an <option> element in WebKit be customized by adding an icon to it?

I have integrated a WebView into one of my software applications, and within the HTML page it is rendering, there is a <select> tag. I am interested in enhancing the <option> elements within this select tag by adding icons to them: (The shadow ...

Is it possible to save an entire webpage that infinitely scrolls without actually manually scrolling through it?

I'm dealing with a webpage that has infinite downward scrolling. I tried automating the scrolling, but eventually the page became too large to continue scrolling. To fix this, I manually removed some DIV blocks from the source code which decreased the ...

Clicking on the Submit button of the post form simply refreshes the page

Every time I try to submit values from an HTML form, the page reloads without any changes. I've double-checked the routes and controller, but everything seems correct. Solution <div class="panel-body"> @if (session('status')) ...

What is causing the floated element to overlap the element below instead of vice versa?

div { background-color: #00FFFF; } p { width: 50px; height: 50px; border: 1px solid black; margin: 0px; } #p1 { background-color: red; float: left; } #p2 { background-color: green; } #p3 { background-color: orange; } #p4 { backgr ...

What is the best way to conceal a CSS div through PHP if the div is empty?

I need some help refining my previous question to ensure clarity. Is there a straightforward method for hiding a div when it doesn't contain any information, without causing confusion for the client? This specific div receives information from Jooml ...

How to display and download a PDF file on a JSP web page

Can anyone help me with a simple trick to solve this question I have? In my project folder, I have 5 PDF files named file1.pdf, file2.pdf, file3.pdf, file4.pdf, and file5.pdf. I want to display these files in 5 rows on my webpage, each row containing VIEW ...

Encountering the Selenium Webdriver HTTP error within an Angular 4 project

ERROR Detected Issue found in: ./node_modules/selenium-webdriver/http/index.js Module not found: Error: Unable to locate 'http' in 'C:\Users\aprajita.singh\Documents\Angular 4\Auto-Trender-Project\node_modules ...

Display div content depending on the clicked ID in AngularJS

Unique Header Links HTML <ul ng-controller="pageRouteCtrl"> <li ui-sref-active="active"> <a ui-sref="home" class="" ng-click="getPageId('live-view')">LIVE</a> </li> <li> <a ng-clic ...

Update the href attribute when a button is clicked

Note: The buttons in the corner will not be submitting the search. The go button would still need to be clicked to submit it. Currently, I am working on a fun project during my free time at work. This project is not meant to be anything serious, but rathe ...

Running PHP scripts within an Angular2 CLI application

I'm currently working on an Angular 2 app using Angular CLI, but I've noticed that the PHP files are not being compiled correctly. I'm curious if the server that is included with Angular CLI supports PHP. If not, do you have any recommendati ...

What is the method for including a placeholder with sequential numbering?

When I click on the "Add String" button, it clones the first table row with an input in the table and adds it to the table. I also need to add a +1 number in the placeholder of the copied element. How can I determine the last placeholder before copying and ...

What mechanism allows Angular 2 to identify the parent instance without the need for explicit coding?

Can anyone provide some insight for me please? I have been following this example to create a simple wizard app in Angular 2. Everything is working smoothly, but what confuses me is the constructor in the file called my-wizard-step.ts. How does the private ...

Bootstrap 4 Card Body Spinner Overlay with Flex Alignment

Seeking to center a spinner both vertically and horizontally within a bootstrap 4 card body. Despite trying my-auto, justify-content-center & align-items-center, it seems like I'm missing something. I've double-checked the display types and ...

Angular2 - Setting focus on input field during component initialization

Currently, I am working on developing a component in Angular2 (Beta 8) that consists of a textbox and a dropdown. One requirement I have is to automatically set focus on the textbox when the component is loaded or when the dropdown selection changes. Can a ...

Customizing styles for specific days on the mat-calendar component

Does anyone have suggestions on how to add a custom class to specific dates in an array? I want to highlight certain events. Here is the HTML code: <mat-card-content> <div class="date-picker"> <mat-calendar [selected]="selectedDates" ( ...

Is there a way to locate a file by inputting a partial name?

How can I create a search bar that allows me to find files in a folder (songs) by typing only part of the song name? For example, if I type "he," it should show results like "hello" and "hey." Is there a way to take my input and search for it within file n ...