简体   繁体   中英

Issue with element positioning and css translation in Safari

I have a popup to which I apply these properties:

position: absolute;
top: 50%;
left: 50%;
width: 80%;
max-width: 700px;
height: 80%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);

While this works perfectly on Chrome, I get a strange issue on Safari. Basically as soon as the popup changes size the rendering/graphics of the element move away from its real position. Here's a photo that might help understand better this weird behaviour.

在此处输入图片说明

So the popup is perfectly centered, as well as all its child elements, but the render/graphics are somehow translated. For instance, if I want to click on the X to close the popup I have to click on the "supposed" position (the one highlighted in blue in the picture) and not the "visible/rendered" one.

Is there any solution to this issue?

You can set content in a <center></center> or add attribute like this: div.popup.project.dark{ text-align: center; } div.popup.project.dark{ text-align: center; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM