meteor957
0D
V2EX  ›  问与答

请问前端那种可视化大屏该如何用 CSS 布局

  •  
  •   meteor957 · May 27, 2020 · 4555 views
    This topic created in 2351 days ago, the information mentioned may be changed or developed.

    类似淘宝那种页面都是固定一个最小宽度,然后两边留白。如果要完美做到 横向纵向铺满整个屏幕 且无滚动条,该利用哪些 css 属性来布局。

    想到一种极端办法,所有元素尺寸都是百分数,但是字体和边距该怎么办

    6 replies  •  2020-05-27 21:22:52 +08:00
    liyang5945
    liyang5945
    May 27, 2020
    1
    rem 可破,其实就是百分比
    clown007
    clown007
    May 27, 2020
    2
    用背景图片
    body {
    background-image: url('xxx');
    background-repeat: no-repeat;
    background-position: center;
    background-attachment: fixed;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    }
    remon
    remon
    May 27, 2020 via Android
    3
    2020 年了,vw, vh
    dioxide
    dioxide
    May 27, 2020
    4
    补充下: css grid 对此场景挺有用的
    ArtIsPatrick
    ArtIsPatrick
    May 27, 2020 via iPhone
    5
    字体也百分比呗
    zhyd1997
    zhyd1997
    May 27, 2020
    6
    postcss-px-to-viewport
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1385 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:46 · PVG 06:46 · LAX 14:46 · JFK 17:46
    ♥ Do have faith in what you're doing.