When you hover over the page, the content shifts to reveal a hidden div

Trying to figure out how to show additional content when a photo is hovered over without shifting the rest of the page's content placement? Looking for alternative solutions rather than using margin-top: -22%.

Here's a link to the website in question:

<!Doctype html>
    <html>
    <head>
    <title>Home Page</title>
    <link rel="stylesheet" type="text/css" href="MyHomePage.css">
    </head>
    <body>
    <img class="cnetheader" src="cnetheader.png" alt="cnetheader" height="100%" width="100%">

    <img class="searchBar" src="searchBar.png" alt="cnetheader" height="100%" width="50%">

    <img class="eCommerce" src="eCommerce.png" alt="cnetheader" height="100%" width="92%">

    <img class="freelancer" src="freelancer.png" alt="cnetheader" height="100%" width="100%">

    <img class="photoHeader" src="photoHeader.png" alt="cnetheader" height="100%" width="100%">

        <img src="photos2.png" width="100%" height="100%" border="0" usemap="#map" />

        <map name="map">

    <div class="photo1">
        <area shape="rect" coords="63,13,451,260" href="https://www.google.com" />

        <div class="photo1-content">
            Only visible on hover
        </div>
    </div>

<div class="photo2">
    <area shape="rect" coords="481,13,870,258" href="https://www.google.com" />
    <div class="photo2-content">
            Only visible on hover
    </div>
</div>

<div class="photo3">
    <area shape="rect" coords="900,12,1290,258" href="https://www.google.com" />
    <div class="photo3-content">
        Only visible on hover
    </div>
</div>

<div class="photo4">
    <area shape="rect" coords="60,300,450,545" href="https://www.google.com" />
    <div class="photo4-content">
        Only visible on hover
    </div>
</div>

<div class="photo5">
    <area shape="rect" coords="483,301,870,545" href="https://www.google.com" />
    <div class="photo5-content">
        Only visible on hover
    </div>
</div>

<div class="photo6">
    <area shape="rect" coords="899,300,1288,545" href="https://www.google.com" />
    <div class="photo6-content">
        Only visible on hover
    </div>
</div>
</map>

<img class="enterprise" src="enterprise.png" alt="cnetheader" height="100%" width="100%">

</body>
    </html>


.eCommerce{
    margin-left: 7%;
}

.photo1-content{
    display: none;
}

.photo1:hover .photo1-content{
    display: block;
    margin-top: -22%;
    margin-left: 13%;
}

.photo2-content{
    display: none;
}

.photo2:hover .photo2-content{
    display: block;
    margin-top: -22%;
    margin-left: 44%;
}

.photo3-content{
    display: none;
}

.photo3:hover .photo3-content{
    display: block;
    margin-top: -22%;
    margin-left: 75%;
}

.photo4-content{
    display: none;
}

.photo4:hover .photo4-content{
    display: block;
    margin-top: -1%;
    margin-left: 13%;
}

.photo5-content{
    display: none;
}

.photo5:hover .photo5-content{
    display: block;
    margin-top: -1%;
    margin-left: 44%;
}

.photo6-content{
    display: none;
}

.photo6:hover .photo6-content{
    display: block;
    margin-top: -1%;
    margin-left: 75%;
}

.enterprise{
    position: static;
}

Answer №1

To achieve the desired layout, employ a mix of position:absolute along with the properties top, bottom, left, right.

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

What is the process of invoking a secondary "external" function with Nodejs, Expressjs, and bluebird?

Struggling with creating a nodejs application, a new area for me. I've managed to work with Promises and fetch data from a database. Take a look at the code below: myModel.js var express = require('express'); var app = express(); var Promi ...

Having issues with ASP.NET MVC AJAX PartialView not loading Telerik UI components

I am facing an issue with a PartialView that I update using AJAX. The HTML elements load correctly when updating the Div with AJAX, but the Telerik chart is not loading. The datasource in the chart does not call the Action method: .DataSource(ds => ds. ...

What do the transition props for Material-UI (MUI) entail

Can you provide more information on React MUI transition props besides "transform"? transition: theme.transitions.create(["color", "transform"], { duration: theme.transitions.duration.shortest, }) I have been looking through the MUI documentation but I am ...

Tips for fixing the issue of "The use of getPreventDefault() is outdated. Please use defaultPrevented instead."

When attempting to fetch data for a specific user from an SQL Server database using JSON data, I encountered an error message in the console: "Use of getPreventDefault() is deprecated. Use defaultPrevented instead." Additionally, the values are not bei ...

Angular has developed a content script that automatically fills in user passwords on forms

I have developed a content script extension that automatically fills in user and password fields on webpages. It works perfectly fine on regular forms like the one below - <input name="userId" class="form-field" id="userId" placeholder="Username" autoc ...

Retrieve the most recently added item in the Material-ui Autocomplete component

Currently, I am incorporating the material-ui Autocomplete component with multiple selection feature. In one specific scenario, I require the ability to retrieve only the value of a newly added item. Despite utilizing the onChange listener, the event pro ...

Setting up a nodejs application on a web server

As a newcomer to NodeJS, I am currently learning how to create a sample app using this technology. I have successfully tested it on my localhost, but now I am facing issues when trying to host it on a public server. var http = require('http'); ...

What is the best way to trigger a function once another one has finished executing?

After opening the modal, I am creating some functions. The RefreshBirths() function requires the motherId and fatherId which are obtained from the getDictionaryMother() and getDictionaryFather() functions (these display my mothers and fathers on the page s ...

The functionality of angular-ui's ui-utils and ui-scroll module is currently nonfunctional in version 0.1.0

I have been trying to implement the features from this Angular UI library: http://angular-ui.github.io/ui-utils/, particularly focusing on this aspect: https://github.com/angular-ui/ui-utils/blob/master/modules/scroll/README.md Unfortunately, despite my e ...

Ways to incorporate react suspense with redux toolkit

I am currently using Redux toolkit to display data from an API, and I want to show the user a "loading data..." message or a spinner before displaying the city information. I have been attempting to use React Suspense, but it doesn't seem to be worki ...

The link function of an AngularJs directive is unable to access the attribute value

I am facing an issue with a directive in AngularJS. return { restrict: _restrict, link: function (scope, element, attrs) { $timeout(LinkPre, 0); //Calling a scoped method }, templateUrl: Con ...

What is the best way to show the user's name on every page of my website?

I'm facing an issue where I can successfully capture the username on the home page using ejs after a login, but when transitioning to other pages from the home page, the username is no longer visible. It seems like I am missing some logic on how to ha ...

Refreshing data and manipulating arrays using AngularJS

Currently, I am developing an application utilizing AngularJS and LocalStorage. I've encountered a challenge that seems a bit too intricate for me to handle. The app involves managing lists of people with the ability to add arrays of names. The proce ...

Determine if the user's request to my website is made through a URL visit or a script src/link href request

Presently, I am working on developing a custom tool similar to Rawgit, as a backup in case Rawgit goes down. Below is the PHP code I have created: <?php $urlquery = $_SERVER['QUERY_STRING']; $fullurl = 'http://' . $_SERVER['SE ...

Creating a seamless scrolling experience with a designated stopping point - here's how to achieve it!

I understand how to implement a scroll effect on an element with a specific class or ID. However, I am unsure of how to make the scrolling stop 20px above that element. I have seen examples using document.getElementById() to achieve this: function scr ...

Lock in the top row (header row)

In a node.js application: How can I lock the top row of a table in place, similar to Excel's freeze panes feature? I think this might involve using some CSS styling, but I'm not exactly sure how to achieve it. When I tried using fixed, the entir ...

The issue arises when attempting to render an SVG with JavaScript embedded inside using the img, object, or

Issue with the title ... please follow these steps: (view codes below) Create an svg + open it separately (name it keysaway.svg) Create html + open it individually When you observe, the svg displays a simple up and down animation but fails to work when l ...

What is the best way to display an error message when the JSON result is unsuccessful?

When using Ajax, the success part always executes. However, if an error occurs, I want to display an error message instead of running the normal process. If a discount code is present, I need to show/hide certain div elements along with the code and then r ...

Guide on toggling the expansion and collapse of antd TreeSelect items when a button is clicked

I recently started using the antd library to develop my website. I have successfully implemented the TreeSelect component to display nested options. However, I am currently facing an issue: I am attempting to expand and collapse TreeSelect items when a b ...

Unable to retrieve parameter while making a POST request

Need some help with attribute routing. I'm having trouble getting parameters from the HTTP body. The ConnectionID Class includes a property named CValue. $('#btn').click(function () { $.ajax({ type: "POST", url: "http:// ...