meteor957
0D
V2EX  ›  问与答

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

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

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

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

    6 replies    2020-05-27 21:22:52 +08:00
    liyang5945
        1
    liyang5945  
       May 27, 2020
    rem 可破,其实就是百分比
    clown007
        2
    clown007  
       May 27, 2020
    用背景图片
    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
        3
    remon  
       May 27, 2020 via Android
    2020 年了,vw, vh
    dioxide
        4
    dioxide  
       May 27, 2020
    补充下: css grid 对此场景挺有用的
    ArtIsPatrick
        5
    ArtIsPatrick  
       May 27, 2020 via iPhone
    字体也百分比呗
    zhyd1997
        6
    zhyd1997  
       May 27, 2020
    postcss-px-to-viewport
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5913 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 242ms · UTC 06:21 · PVG 14:21 · LAX 23:21 · JFK 02:21
    ♥ Do have faith in what you're doing.