html - Microsoft Edge 中的 CSS 位置问题

标签 html css microsoft-edge

我绝不是网络开发人员,我更关注基础设施方面的事情。不管怎样,我在 XServe G4 上构建了一个带有 AMP 堆栈的 FreeBSD 服务器,并想修饰只打印“It Works!”的通用登录页面。当我遇到 CSS 问题时,在纯白屏幕上显示更有趣的内容。

这是页面 - 它在 Mac 和 Win10 上的 Chrome、Opera、Safari 上完全按照预期的方式工作(我没有检查 Win10 上的 Safari)

Landing Page

在 Microsoft Edge 上,我得到了这个:

Landing Page on Edge

我需要在 CSS 中做什么才能正确定位该元素?

页面代码如下

<html>
<head>
<style>
body {
           background-image: url("splash.png");
           background-repeat: no-repeat;
           background-position: center;
           background-color: #BEBEBE;
           font-family: "Arial", "Verdana", "serif";
           justify-content: center;
       }

  #container { display: block; position: relative;
               width: 60%; 
               top: 60%;   
               font-weight: bold;
               margin: auto;
       }



   #pretext { display: inline-block; color: #b80000; font-size: 3em;
            }
   #posttext { display: inline-block;
               color: #FFFFFF; font-size: 3.5em;
               font-weight: 1500; }

   #logo   {
             height: 50px; 
             position: absolute; 
             bottom: 1%;
             right:  1%;
             padding-bottom: 5px; 

           }
   #logo img   { height: inherit; vertical-align: top; }

   #svr-info { font-size: .75em; 
               color: #dae6f7;
               width: auto;
               position: absolute;
               bottom: 0px;
               right: 10px;
               padding-top: 5px;

             }

    #phpinfo a  {  font-size:  .75em;
                   text-decoration: none;
                }

     a:hover { font-size:  1.3em; }


</style>
</head>
<body>

<div id="container">
  <div id="pretext">Think</div>
  <div id="posttext">Correctly.</div>
</div>
<div id="logo">
  <img src="powerpc-logo.png" />
  <img src="apple-logo.png" />
</div> <br>

<div id="svr-info">
<?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    echo "---";
    echo php_uname('r');
    echo "  ";
    echo php_uname('m');

?>
</div>
<div id="phpinfo">
<a href="test.php"> PHPINFO Page</a>
</div>

</body>
</html>`

最佳答案

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8"/>
    <style>
        body {
            margin: 0px;
            padding: 0px;
        }
        .container {
            height: 100vh;
        }
        .text1 {
            display: inline-block;
            margin: 0 auto;
            
        }
    </style>
</head>
<body>
<div class="container" >
    <div style="display: table; margin: 0 auto; text-align: center; position: relative; top: 30%;">
        <img src="logo.png" style="width: 100px; height: 100px;"/>
        <br/>
        <h1 class="text1">Think Correctly</h1>
    </div>

    <div style="position: absolute; bottom: 10px; right: 10px;">
        <img src="logo2.png"/><span>Logo 2</span>
    </div>

</div>
</body>
</html>

试着用这段代码来实现 你可以阅读这篇关于使用表格与使用带有显示表格的 div 的文章 divs vs tables

关于html - Microsoft Edge 中的 CSS 位置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35442313/

相关文章:

css - iPad 特定的 CSS Div 问题

css - 背景图像未在 Microsoft Edge 中显示

reactjs - 在 React 中创建的选择控件不会在浏览器刷新时重置(IE11 和 Edge)

javascript 和 css 过渡属性不适用于 firefox

javascript - 水平修复一些 HTML

html - 如何使 div 中此电子邮件选择表单中的 h2 响应?

php - 从 blender 导出的 .X3D 文件具有黑色背景,我无法更改

javascript - CSS 将 div 与动态内容垂直对齐

javascript - jQuery 如何垂直和水平居中图像 a.k.a. 图像灯箱?

c# - 使用 System.Windows.Automation 读出 Edge 浏览器标题和 URL