简体   繁体   English

对Google资料设计应遵循的一些规则的怀疑

[英]Doubts on some Rules to be followed for Google material design

I'm trying to use material design concept for web app. 我正在尝试将材料设计概念用于Web应用程序。 In Google docs they have mentioned some spacing rules in dp. 在Google文档中,他们提到了dp中的一些间距规则。

在此处输入图片说明

Measurements in the above image are in dp and sp. 上图中的测量单位是dp和sp。 ( Check here ) scroll down in that docs till specs section for field and label spacing measurements. 在此处检查 )在该文档中向下滚动,直到“ specs”(规格)部分进行字段和标签间距的测量。 To follow these measurements I cant figure out how to calculate px value from dp. 为了进行这些测量,我无法弄清楚如何从dp计算px值。 The dp formula as mentioned in google docs is 谷歌文档中提到的dp公式是

dp = (width in pixels * 160) /  screen density

For formula 对于公式

To use this formula I need Screen density. 要使用此公式,我需要屏幕密度。 So Here is the question. 所以这是问题。

How do you calculate screen density from your web application? 如何从Web应用程序计算屏幕密度?

From the Material Design Guildelines : 材料设计准则

When writing CSS, use px wherever dp or sp is stated. 编写CSS时,在说明dp或sp的地方都使用px。 Dp only needs to be used in developing for Android. Dp只需要在Android开发中使用。

That means: You don't need to find out the screen density (which won't be easy to do anyway). 这意味着:您无需找出屏幕密度(无论如何都不容易做到)。

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

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