简体   繁体   English

懒惰的人使用Polymer 1.x实施材料设计样式的方式是什么?

[英]What's the lazy person's way of implementing material design styling using Polymer 1.x?

When it comes to styling a forms based web app (or pages, components, etc.), how do I build it using the least amount of CSS, style tags, style classes, and style attributes possible? 在设计基于表单的Web应用程序(或页面,组件等)的样式时,如何使用尽可能少的CSS,样式标签,样式类和样式属性来构建它?

My understanding was that the paper-* elements implement an opinionated material design style that can be used to build components with similar material design out-of-the-box. 我的理解是, paper-*元素实现了自以为是的材料设计风格,可用于开箱即用类似材料设计的组件。

I'm trying to build an internal app for employees at my company (thus, as long as it's not bad, styling is not that important). 我正在尝试为公司的员工构建内部应用程序(因此,只要它还不错,样式就不那么重要)。 It's basically a bunch of forms pages that look like many of the protoypical menu-driven web sites (like the polymer docs pages ): 它基本上是一堆表单页面,看起来像许多原型菜单驱动的网站(例如polymer docs页面 ):

  • Nav menu on the left 左侧的导航菜单
  • Menu selected content on the right - text reports and forms mostly 菜单右侧的所选内容-主要是文本报告和表格
  • header/logo on top 标题/徽标在顶部

However, when I tried to copy some things (like item list boxes) out of the elements catalog like the paper-item demos I couldn't match the look in my components simply by copying the HTML. 但是,当我尝试从元素目录中复制一些内容(例如项目列表框)(例如paper-item演示)时,我无法仅通过复制HTML来匹配组件中的外观。 The demo HTML referenced classes for which I had to copy a bunch of <style> tags in order to get them to work. 演示HTML引用了一些类,为了使它们起作用,我必须为其复制一堆<style>标记。

It felt like a lot of re-inventing the wheel to copy an often repeated look. 感觉就像在重新发明轮子以仿制经常重复的外观一样。

I'm not sure if I understand your problem. 我不确定我是否理解您的问题。 The paper-* elements aren't meant to build components, they ARE components. paper- *元素不是用来构建组件的,它们是组件。 If you want to use them you have to go the full way. 如果要使用它们,则必须完全使用。 If you use them as intended, they look like in the demos out of the box. 如果按预期使用它们,则它们看起来像开箱即用的演示。 You can't just copy the HTML. 您不能只复制HTML。 A more traditional way to get the material-design-look is Materialize or Googles own MaterialDesignLite . 获得材料设计外观的一种更传统的方法是Materialize或Google自己的MaterialDesignLite

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

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