top | item 9432148

A modern responsive front-end framework based on Material Design

215 points| czottmann | 11 years ago |materializecss.com | reply

94 comments

order
[+] pan69|11 years ago|reply
Looks great. However, I've never really understood this sort of approach:

    <ul class="collection">
      <li class="collection-item">Alvin</li>
      <li class="collection-item">Alvin</li>
      <li class="collection-item">Alvin</li>
      <li class="collection-item">Alvin</li>
    </ul>
Rather than assigning a "collection-item" class to each "li", would you not simply style the "li" in the context of "collection"?

Bootstrap does a similar thing. Drives me nuts...

[+] danielmason|11 years ago|reply
There's a reasoning behind this. You may not agree with it, but it's good to fully understand the problem it's trying to solve.

There are two problems with your suggested approach -- specificity and coupling. The rules of CSS are such that .collection > li is a more specific selector than .collection-item. So if you want a particular item in the list to be red, you can't just give it a class name .warning-item and style against that -- you have to match or exceed the existing specificity. In the simple case, this isn't too bad, but it's surprisingly easy to end up representing deeply nested structures in your CSS which are very difficult to override.

The coupling problem is really just a way of saying that it might not be a good idea to describe the specifics of your HTML implementation in CSS. Class names are like an interface. One refactoring I've actually done a lot is switching out lists like the above for a combination of nav and anchor elements. It's great to be able to do that without needing to rewrite all the corresponding CSS, too.

These are tools designed to help you manage complexity and increase flexibility, not dogma. If you don't find your HTML needing to change much, or you don't need to make styles overrideable, then YAGNI. Hopefully it makes sense why framework authors, whose work is explicitly designed to be overridden, would choose this approach.

[+] weego|11 years ago|reply
It's so you don't clobber the underlying styles, otherwise you end up having to reset on top of the frameworks resets and styles on the odd occasion you want one of the collection li's to not have the styles.

I tend to agree with you, but I was heavily chastised by lead the front end dev at my last gig for ever directly applying design styles to tag entities as doing it as above is considered best practice at the moment (until the cycle comes around again to another best practice).

[+] yummybear|11 years ago|reply
My personal experience is:

Using element names instead of class names can be problematic. In some frameworks you may need to use a different element or an element that wraps another element to achieve certain functionality.

Some use generic names like "button large" as class names, but, again in my personal experience, it often causes problems. You might have other elements that need to be "large" and may need to be inside a button - but which "large" do you mean.

So to keep things predictable, I've adopted the following practices:

- Always namespace components.

- Always ensure that selectors work even if the child has a wrapper around it.

- Whenever possible use classnames instead of element names.

And to ensure I don't get tendonitis (not sure if everyone agrees with this):

- If possible provide a shorthand for at least the most used components (i.e. "col"/"col-i" for "collection"/"collection-item"

[+] CleanCoder|11 years ago|reply
SMACSS - Scalable and Modular Architecture for CSS.
[+] EugeneOZ|11 years ago|reply
What will you do when you need div.a list instead of ul.li?
[+] spdustin|11 years ago|reply
Many comments here use the phrase "best practices" as a means to shut down opposing opinions or practices. That feels very wrong to me.

I am often heard saying (in classes, public presentations, etc.), "I don't like the phrase 'best practice'. It implies that someone knows your requirements better than you. So I don't use it. What's 'best' for me might suck for you. So I say: the best practice is, in many cases, simply to have a practice that you and your team adhere to. One which meets your requirements, now and foreseen."

Class-itis, div-itis, selector-nesting-itis... They all have a place in the Real World.

[+] tehchromic|11 years ago|reply
i think this is a good perspective. at the some practices are clearly better than others, and sometimes it is appropriate to say "best practice", because in certain narrowly defined circumstances, there really is a best. but the idea of team practice as the goal overall, and best practice as something that is both personal and defined by external circumstance is solid.
[+] V-2|11 years ago|reply
Nice.

I'm not a Google fanboy, but I believe Material is the best visual language for UI. Okay, there are different contexts, but it's best thought-through, and most modern.

For instance, the use of animation is finally mature and at the same rich and amplifying user experience (rather than being an eye-candy).

And I think it's very compatible with web apps.

A Material-ish popular chess site: http://en.lichess.org/ (I'm in no way associated, but a happy user)

[+] Karunamon|11 years ago|reply
What? Why? I personally find Material to be hideous because of its color abuse. It makes your UI look like an over-saturated Fischer-Price toy because of all the bright primary colors everywhere, and that's before we get into the lack of shadow and shading that seems to have infected "modern" design.
[+] bjterry|11 years ago|reply
One thing I've noticed about Material Design is that most of the examples of "best designs" have elements that are overlapping to some extent, but none of the frameworks that I see make it easy to have overlapping elements with defaults like grid layouts. I guess this isn't limited to just material design though. It seems like many times overlapping visual elements is a subtle indicator of a more professional design. Is there a solution to this problem using CSS (I mean, I know how to overlap elements, but ideally there would be something more structured or principled) or is it just doomed to be difficult?
[+] DougWebb|11 years ago|reply
I don't know any frameworks that do it, but it seems like you could have an element that fits into the normal grid, and then inside that have an element with a "breaks the grid" class applied which uses positioning raise it up and make it overlap grid boundaries. You might need a special class on the parent element too so you can prevent it from collapsing. This seems like something that can be done in a fairly generic way.
[+] bjrnjs|11 years ago|reply
This looks really good, but the jQuery dependency makes it unfortunately less interesting. It should be possible to have the jQuery dependency optional, possibly only for legacy browser support.
[+] sergiotapia|11 years ago|reply
On the other hand, supporting jQuery makes it better on my end because it's easy to integrate.
[+] Taig|11 years ago|reply
This framework really impressed me when I first saw it and made me immediately wanna use it. However, when I took a closer look I found a few things that annoyed me:

- The required HTML classes seemed kinda bloated and not semantic, but I intended to fix that with Sass (well, officially they're on Less)

- The input elements have weird animation on page load

- When I just dropped in some basic elements, like an input field (with its wrappers) nothing was really working. Things were not properly aligned and I had to add all this container/row/column stuff, even though I just came for the widgets

And last but not least what made me finally ditch it:

- To display form validation errors, I have to supply a data-error attribute which will then get rendered via css as a pseudo ::after to the label. That is just weird. I then checked how it works without JavaScript and saw labels overlapping placeholders.

It looks beautiful and I like how comprehensive it is. Really hope they'll improve on some of these technical flaws.

[+] andres|11 years ago|reply
If you have a second check out MUI, which is a lightweight Material Design framework that addresses some of your technical concerns: https://www.muicss.com

Let me know what you think!

[+] jmett|11 years ago|reply
Regarding the labels overlapping placeholders, adding the "active" class to the label solves this.
[+] ozten|11 years ago|reply
Overall, very cool project!

The menu animation is really slow on Firefox 37 on Mac OS X. The way pages load and then more animations happen seems jarring. I've not used any material based apps, so maybe I'm just not used to how things work.

[+] they4kman|11 years ago|reply
I'm using this library for a side project, whose main application is on mobile. The layout system and styles are absolutely fantastic, but the library falls short on forms.

Specifically, the range input uses a bubble on mouseover, which is not touch-screen friendly. I've also had minor issues with the select widget not closing after a selection is made. Additionally, the styles for labels is inconsistent amongst different input types.

For everything else, this library is wonderful. The forms area could use some polish.

[+] smoe|11 years ago|reply
I have started using it this week and really like it so far.

But there were two annoyances: Select elements (without .browser-default class) are display:none and only shown, when initiated via javascript and similarly checkboxes are put off screen and thus invisible if there's no corresponding label (in my case the ones to select rows in a table).

Of course they were easily fixed. But it seems odd to me, to make unexpected things like that the default behavior and – in the case of the selects – risk making your site/app unusable if something goes wrong in your js just to avoid a flash of unstyled content.

[+] smrtinsert|11 years ago|reply
Been playing with this project. The team is energetic and responsive, submitted a bug and it was fixed literally in a few hours. They seem committed to producing a top css framework, and of course its already gorgeous.

Great work.

[+] ben_hall|11 years ago|reply
I've been using it for the past six months, very powerful however it's important to try and understand the underlying Google Material Design guidelines otherwise elements can look out of place.
[+] Raphmedia|11 years ago|reply
I understand that the localisation of the text is done by JS, but god that flicker on the menu annoys me. You should hide the menu and only display it after the work has been done. Make it fade in or use some other material design animation.

Edit: Why is this getting downvoted? This is a page made to present a framework based on material design. Flickering instead of smoothly presenting content is the anti-thesis of material design. If your demo page features a big annoying issue, this is giving a very bad impression to your users.

[+] zhte415|11 years ago|reply
This looks really nice, and I will try it in a project. The responsiveness doesn't seem to totally work though, perhaps an environment not tested.

Desktop:

I tried this by progressively shrinking my (desktop) browser window width to around 200px, and the main content seemed to get stuffed under the left menu with no responsive re-layout. [IE 11 on Windows 8.1].

Mobile:

I tried on my mobile (Android 4.4.2 480*800, Firefox - worked OK on default browser) the design was definitely for mobile (no problem like the above) apart from a ~20px white margin for the content on the right.

[+] subpixel|11 years ago|reply
This is impressive. I'll just have to override the form styling - personally I find the material approach to forms to be a case of trying to fix something that isn't broken.
[+] starikovs|11 years ago|reply
It's really cool. They use flexbox in some places! I don't understand why bootstap hasn't do that yet.
[+] roughcoder|11 years ago|reply
If it was not for the need to have a fallback for IE9 I would be using flexbox as standard, its a great feature with deals with so many of the common page layout issues, including vertical align.

Bootstrap is quite web focused still so I guess it will come when support for IE9 is not expected.

Though if you are doing an mobile/tablet only solution I would probably use flexbox only now. As long as you keep to the 2012 spec, you should be ok.

http://caniuse.com/#feat=flexbox

Bring on the death of IE9!!

[+] ac360|11 years ago|reply
This looks beautiful and it's wonderful to have more options than Bootstrap. I also recommend Skeleton for anyone who wants a super minimal UI framework: https://github.com/dhg/Skeleton
[+] Tankenstein|11 years ago|reply
Have been using this in production for about 4 months now, still has a lot of quirks to iron out, but nothing you can't solve pretty fast. It's noticeably (and obviously) less mature than bootstrap, but it's definitely worth a shot. I quite recommend it.
[+] tinussky|11 years ago|reply
Bootstrap material design has something similar, although it is not matured yet: https://github.com/FezVrasta/bootstrap-material-design