简体   繁体   English

角材料网格系统

[英]angular material grid system

I am confused with angular material design and material css . 我对角材料设计材料css感到困惑。 Why do both have different layout and grids? 为什么两者都有不同的布局和网格? What is the equivalent for bootstrap container in angular material design ? 角材料设计中 bootstrap容器的等价物是什么?

Shall I use angular material design for my project comparing with bootstrap? 与引导程序相比,我应该为我的项目使用角度材料设计吗?

The main reason to go with Angular Material is because it is based on Flexible Box Layout specification, witch is a W3C standard Flexible Box . 使用Angular Material的主要原因是因为它基于Flexible Box Layout规范,是W3C标准的Flexible Box

The closer tag for bootstrap container could be: <div layout="row" layout-wrap></div> bootstrap容器的close标签可以是: <div layout="row" layout-wrap></div>

Angular Material Design does not have an exact equivalent to a Bootstrap container because Material Design (AMD) is more flexible. Angular Material Design没有与Bootstrap容器完全等效,因为Material Design(AMD)更灵活。 A container has 8 sections. 一个容器有8个部分。 AMD has the layout and flex attributes. AMD具有布局和flex属性。 AMD's flex can increment by 5% (20 sections in BS) or by 33 and 66 (2 sections) or by combinations of 5%, 33% and 66%, which can go to more than 100% (most any number of sections) in which case multiple lines are automatically created. AMD的弹性可以增加5%(BS中的20个部分)或33和66(2个部分)或5%,33%和66%的组合,可以超过100%(大多数任何部分)在这种情况下,会自动创建多行。 The best single page with examples that I've found, so far, is https://material.angularjs.org/#/layout/grid Click on the Source box above each example to get more specifics about AMD's HTML syntax for layout and flex. 到目前为止,我找到的带有示例的最佳单页是https://material.angularjs.org/#/layout/grid单击每个示例上方的Source框以获取有关AMD的HTML布局和语法的更多细节柔性。

You have further flexibility via Child Alignment, which controls spacing between each div in horizontal and vertical. 通过子对齐可以进一步提高灵活性,它可以控制每个div在水平和垂直之间的间距。 Click the radio buttons on that page to see how divs are centered, or spread, or pushed to one end, or lifted to the top, etc. 单击该页面上的单选按钮,以查看div如何居中,展开或推到一端,或者提升到顶部等。

The HTML syntax displayed will work on a set sized page. 显示的HTML语法将在设置大小的页面上工作。 If you want the equivalent of media-queries to change sizes for different devices, you have some further coding to do to make angular controllers. 如果您希望相应的媒体查询更改不同设备的大小,您可以进行一些编码来制作角度控制器。 Look at the DEMOS examples for various components to get an idea. 查看各种组件的DEMOS示例以获得想法。

Angular Material grid > Bootstrap grid, especially for Angular applications. Angular Material网格> Bootstrap网格,尤其适用于Angular应用程序。 Bootstrap grid uses float , which is outdated compared to flexible box model. Bootstrap网格使用float ,与灵活的盒子模型相比,它已过时。 float replaced the horrendous table layouts, but now flexible box model is starting to push float aside (for grid layouts). float替换了可怕的表格布局,但现在灵活的盒子模型开始推动float (对于网格布局)。 Just note that you need to add certain suffixes in your CSS for older browsers. 请注意,您需要在旧版浏览器的CSS中添加某些后缀。 See this CSS Tricks article for an example of how to implement flex for older browsers. 有关如何为旧版浏览器实现flex的示例,请参阅此CSS Tricks文章 Bootstrap grid applications also require you to create an endless amount of divs, which looks terrible and should be avoided in any application using HTML5. Bootstrap网格应用程序还需要您创建无数的div,这看起来很糟糕,应该在任何使用HTML5的应用程序中避免使用。 Technically, you could write your own Angular directives to replace certain divs, and group them based on what or how they display, but then why not just use Angular Material when they have already done that for you? 从技术上讲,您可以编写自己的Angular指令来替换某些div,并根据它们显示的内容或方式对它们进行分组,但是为什么不在他们已经为您完成时使用Angular Material呢?

Materialize is a modern responsiveCSS framework based on Material Design by Google. Materialise是一个基于Google Material Design的现代响应式CSS框架。

And

Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first web sites. Bootstrap是最流行的HTML,CSS和JavaScript框架,用于开发响应迅速的移动优先网站。

So if you want new modern design i think you should go with material design. 因此,如果您想要新的现代设计,我认为您应该选择材料设计。 It has very nice animation too. 它也有非常好的动画。

I was looking for an answer for the same question. 我正在为同一个问题寻找答案。 I see some great comments here. 我在这里看到一些很棒的评论。 Few additions as of December 2016: Bootstrap does have Flexbox support now. 截至2016年12月,很少有新增内容:Bootstrap现在支持Flexbox。 Check this link also check this link to make bootstrap use Flexbox by default by just changing a flag or download bootstrap-flex.css. 检查此链接还检查此链接以使bootstrap默认情况下使用Flexbox,只需更改标志或下载bootstrap-flex.css即可。 As far as, grid support in material goes, use a grid demo here , there is a material flex-layout engine which looks great (I haven't tried it yet). 至于材料中的网格支持,在这里使用网格演示,有一个材质的flex-layout引擎看起来很棒(我还没有尝试过)。 It is very close to bootstrap grid. 它非常接近bootstrap网格。 Check this link . 检查此链接

if you work with Angular, instead of using grid you should rather use flexbox, Angular provides a package for it: 如果你使用Angular,而不是使用网格,你应该使用flexbox,Angular为它提供了一个包:

https://github.com/angular/flex-layout https://github.com/angular/flex-layout

A huge advantage using it is the fact that you can use typescript public variables to the flex-layout directives (you can't do that with bootstrap). 使用它的一个巨大优势是你可以将typescript公共变量用于flex-layout指令(你不能用bootstrap做到这一点)。 It also includes Observables for media query changes. 它还包括用于媒体查询更改的Observable。

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

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