FF和IE中的元素失真

时间:2018-05-05 04:50:18

标签: html css responsive-design cross-browser css-position

我对网络开发非常陌生,并试图自己建立一个公司网站,我只是遇到一个问题,我有一个红色信息框"在我的页面上。

它在Chrome上看起来很完美,但在Firefox和IE中它看起来很扭曲,附带图片。

Codepen

HTML

<html lang="en">   <head>
     <!-- Required meta tags -->
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

     <!-- Bootstrap CSS -->
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
 integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
 crossorigin="anonymous">


     <!-- Custom CSS -->
     <link rel="stylesheet" href="resources/css/style.css">

     <!-- Custom FONTS -->
     <link href="https://fonts.googleapis.com/css?family=Do+Hyeon" rel="stylesheet">


      <!-- Favicon -->
     <link rel="icon" href="resources/images/logo.jpg" width:"100px">

      <!-- Title of Page-->
     <title>PC Handyman</title>   </head>





         <!-- Landing page Body-->

   <body id="landing-page">
     <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top  " id="spec">   <a class="navbar-brand" href="#">PC Handyman
 <img class="logopic" src="resources/images/logo.jpg" alt=""></a>  
 <button class="navbar-toggler" type="button" data-toggle="collapse"
 data-target="#navbarNav" aria-controls="navbarNav"
 aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>   </button>   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav ml-auto">
       <li class="nav-item active">
         <a class="nav-link" href="index.html">Home <span class="sr-only">(current)</span></a>
             </li>
             <li class="nav-item">
               <a class="nav-link" href="services.html">Services</a>
             </li>
             <li class="nav-item">
               <a class="nav-link" href="about.html">Why PC Handyman?</a>
             </li>
             <li class="nav-item">
               <a class="nav-link disabled" href="contact.html">Contact Us</a>
             </li>
           </ul>
         </div>
       </nav>

       <div class="pop">
         <p>Welcome to PC Handyman, East Auckland's friendliest PC repair service Lorem ipsum dolor sit amet, consectetur adipisicing
 elit. Assumenda, fugiat.</p>
       </div>



     <!-- Optional JavaScript -->
     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
 crossorigin="anonymous"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
 integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
 crossorigin="anonymous"></script>
     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
 integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
 crossorigin="anonymous"></script>   </body> </html>

如果有人可以完全停止导致我的&#34; redbox&#34;在其他浏览器中扭曲。

我确定这与我的&#34; pop&#34;类。

Weird result

Desired result

1 个答案:

答案 0 :(得分:0)

这是你的CSS的问题。用 .pop 类替换这些代码将这些代码放入.css文件

  div.pop {
     position: relative;
     z-index: 9999;
     margin: 0;
     top: 0;
     left: 0;
}
 div.pop p {
     background: red;
     border: 2px solid orange;
     position: absolute;
     right: 0;
     width: 30%;
     top: 20rem;
     color: #fff;
}