简体   繁体   English

CSS-页面顶部和左侧的空白

[英]CSS - White space around top and left of page

I'm building a web app and unfortunately I have a white border around the top and left of the page. 我正在构建一个Web应用程序,不幸的是,页面顶部和左侧周围都有白色边框。 I have set the html and body padding and margin to 0px but it doesn't seem to be having any effect on it. 我已经将html和body padding和margin设置为0px,但似乎对其没有任何影响。 Inside of the body is a single iframe and when I preview the site and I go on inspect element it shows that the padding is on the body... 主体内部是单个iframe,当我预览站点并继续检查元素时,它表明填充物在主体上...

Here is the code - if anyone could take a look that would be great! 这是代码-如果有人可以看看,那就太好了!

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
    <title>index</title>
    <style>
        html {
            height:100%;
        }
        body {
            background-color: #FFFFFF;
            margin: 0px !important;
            padding: 0px !important;
            height:100%;
        }

    </style>

    <!-- copy these lines to your document head: -->

    <meta name="viewport" content="user-scalable=yes, width=320" />

    <!-- end copy -->

  </head>
  <body>

    <!-- copy these lines to your document: -->

    <div id="index_hype_container" style="margin:auto;position:relative;width:100%;height:100%;overflow:hidden;" aria-live="polite">
        <script type="text/javascript" charset="utf-8" src="index.hyperesources/index_hype_generated_script.js?4823"></script>
    </div>

    <!-- end copy -->


  </body>
</html>

JSFiddle JSFiddle

Try setting the margins of the #my-iframe to a negative number, eg -10px : 尝试将#my-iframe的边距设置为负数,例如-10px

#my-iframe {
    width: 100vw;
    height: 100vh;
    border: 0;
    padding: 0;
    margin: -10px;
}

This may cut a small section of the iframed site off, but judging by the look of the site a few pixels off the edge won't do much damage. 这可能会切断iframed站点的一部分,但是从站点外观来看,边缘边缘只有几个像素不会造成太大损害。

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

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