waiaan

ie11 下全屏出现滚动条

  •  
  •   waiaan · Oct 13, 2020 · 1568 views
    This topic created in 2046 days ago, the information mentioned may be changed or developed.

    屏幕分辨率为 19201080,页面宽高写死为 19201080,在 chrome 下 f11 全屏正常,在 ie 下出现滚动条。何解? 谢谢。

    Supplement 1  ·  Oct 19, 2020
    ```html
    <!DOCTYPE html>
    <html lang="en">

    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    body {
    background-color: #000;
    width: 1920px;
    height: 1080px;
    margin: 0;
    padding: 0;
    }
    </style>
    </head>

    <body>
    </body>

    </html>

    ```

    比如上面这个页面,屏幕尺寸为 1920*1080,f11 全屏下 chrome 没有滚动条,ie11 下会出现滚动条。
    6 replies    2020-10-20 16:29:03 +08:00
    haishiwuyuehao
        1
    haishiwuyuehao  
       Oct 19, 2020
    你不贴出代码和数据没法还原问题呀。
    waiaan
        2
    waiaan  
    OP
       Oct 19, 2020
    @haishiwuyuehao
    简单写了个。
    haishiwuyuehao
        3
    haishiwuyuehao  
       Oct 19, 2020
    @waiaan

    楼主的屏幕尺寸指的是“浏览器尺寸”,也就是 window.screen.width, window.screen.height

    楼主想要的尺寸其实是“内容可视化尺寸”,那么也就是:window.screen.availWidth, window.screen.availHeight
    那么这也解决:
    body {
    background-color: #000;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    }
    waiaan
        4
    waiaan  
    OP
       Oct 20, 2020
    @haishiwuyuehao
    我只是单纯想知道为什么 ie 下会出现滚动条。
    haishiwuyuehao
        5
    haishiwuyuehao  
       Oct 20, 2020
    @waiaan 那就不好说了,正常情况下指定高度超出可视化高度都是会产生 滚动条的. 但是 chrome 浏览器 为了美观,在不使用滚轮的时候,滚动条不会出现.

    我是根据贴出来的代码,看到的情况就是,楼主需要一个占满可视化宽高,但是指定了屏幕宽高,从而产生了滚动条的这个事情
    waiaan
        6
    waiaan  
    OP
       Oct 20, 2020
    @haishiwuyuehao 多谢。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   973 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:17 · PVG 06:17 · LAX 15:17 · JFK 18:17
    ♥ Do have faith in what you're doing.