简体   繁体   English

绝对底部定位在Edge和IE中无法正常工作

[英]Absolute bottom positioning not working as expected in Edge and IE

I have an icon that is absolute positioned at bottom: 50px , while this works fine in every browser, Edge and IE are the exceptions. 我有一个绝对位于bottom: 50px的图标bottom: 50px ,虽然这在每个浏览器中都能正常工作,Edge和IE是例外。 I understand there are a lot of problems with Microsoft's browsers and how they render differently. 我知道微软的浏览器存在很多问题,以及它们的呈现方式有何不同。 Here I see that the browser is treating the mid-way point of the 100vh div as the bottom. 在这里,我看到浏览器将100vh div的中间点视为底部。 What I need help with is to position the icon in IE & Edge the same way it is in Chrome, Opera and Firefox. 我需要帮助的是将图标放在IE和Edge中,就像在Chrome,Opera和Firefox中一样。 Thanks. 谢谢。

IE & Edge IE和Edge

在此输入图像描述

Chrome, Firefox, Opera Chrome,Firefox,Opera

在此输入图像描述

HTML HTML

 .content1 { height: 100vh; width: 100%; position: relative; top: 0; z-index: 99; } /* this is the icon I was talking about */ .dropdown_blue1 { width: 25px; padding: 20px; position: absolute; margin: auto; z-index: 99; left: 0; right: 0; bottom: 50px; } 
 <div class="content1"><img class="dropup_blue1" src="../assets/dropup_blue.png" alt=""><img class="dropdown_blue1" src="../assets/dropdown_blue.png" alt=""></div> 

Try with this one, i have changed margin: auto; 试试这个,我改变了margin: auto; to margin: 0 auto; margin: 0 auto;

 .content1 { height: 100vh; width: 100%; position: relative; top: 0; z-index: 99; } .dropdown_blue1 { width: 25px; padding: 20px; position: absolute; margin:0 auto; /* change here */ z-index: 99; left: 0; right: 0; bottom: 50px; } 
 <div class="content1"> <img class="dropdown_blue1" src="../assets/dropdown_blue.png" alt=""> </div> 

I had a similar problem with the two browsers, position absolute was crazy. 我在两个浏览器中遇到了类似的问题,绝对位置很疯狂。 In style section I had. 我有风格部分。

td.Cir  {width:7in; height:7in; background-image:url('clock.png'); 
  background-size: 45%; background-position: center; 
  background-repeat:no-repeat; position:relative; font-size:28pt;
  min-width:7in; max-width:7in; text-shadow: -1px 0 blue, 0 1px blue,
  1px 0 blue, 0 -1px blue;}

In a table I had 在我的桌子上

</td></tr><tr><td class='Cir'>...</td><td>...</td></tr>

I changed code to 我把代码更改为

<table><tr><td class='Cir'>...</td><td>...</td></tr></table>

and Edge and IE now work fine 和Edge和IE现在工作正常

I fixed it! 我修好了它! Simply use margin-left: auto; 只需使用margin-left: auto; and margin-right: auto; margin-right: auto; instead of margin: auto; 代替margin: auto;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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