简体   繁体   中英

Fixing a div element to a position when the page is zoomed, not while scrolling

I hav a div element like this:

<div class="AvailabilityDiv" style="margin: -15px 0 0 51%;">
     Available 
     <asp:Literal runat="server" ID="litAvailabilityHeaderTop"></asp:Literal>
</div>

This positions the div where I want it, however when the page is zoomed I want to keep it where I put it. At the moment the element moves to the left if the user zooms out. I have tried position: fixed but that only holds it when it scrolls, not zooms. My question is how can I hold this where it is when the user zooms in or out???

Don't use percentage margin. style="margin: -15px 0 0 51%;"

It's hard to know the problem without the code.

You can see this link

The "box1" without percentage margin will not move to left. The "box2" with percentage margin will move to left.

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