What's dp (density independent pixels) units with CSS?

前端 未结 8 1329
陌清茗
陌清茗 2020-12-23 10:39

For Android, people recommend using dp (density independent pixels) measurements for UI elements, and there are conventions that exist such as using 48dp for a

8条回答
  •  旧巷少年郎
    2020-12-23 11:39

    http://www.w3.org/TR/css3-values/#lengths

    The closest unit available in CSS are the viewport-percentage units.

    • vw - Equal to 1% of the width of the initial containing block.
    • vh - Equal to 1% of the height of the initial containing block.
    • vmin - Equal to the smaller of vw or vh.
    • vmax - Equal to the larger of vw or vh.

    The only mobile browser to be aware of that doesn't support these units is Opera. http://caniuse.com/#feat=viewport-units

提交回复
热议问题