Live data from Hacker News

A modern responsive front-end framework based on Material Design

materializecss.com

41–50 of 96 posts

Re: A modern responsive front-end framework based on Material Design

#41
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.

Re: A modern responsive front-end framework based on Material Design

#42
post #2

Looks great. However, I've never really understood this sort of approach: Alvin Alvin Alvin Alvin 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...

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.

Re: A modern responsive front-end framework based on Material Design

#43
post #6

Earlier quoted context omitted.

Tell your lead front dev this approach isn't best practice at all. You want one collection li's to not have the style? Use an alternative class on the ul: "collection collection-alt". You want nested li's to not inherit the styles? Use ".collection > li" in your CSS. In any case, assigning a class on each li goes exactly against CSS best practices, because it prevents taking advantage of the inheritance of property v…

I don't agree with this. Do you have some references about your statement. I think the whole community went to separating the HTML tag names from the styles and work only with class names [1]. If you start styling your tags directly it imminently increase the code debt if you scale. Let's say you just want to add another element inside the tag. I can give you example : .collection > li { color: red; } and later on yo…

Thank you for pointing to the interesting BEM article.

As to this specific case, though, I was surprised to see your "this will not work" comment and tested it. It worked: http://jsfiddle.net/brlewis/p0Locwgp/

Re: A modern responsive front-end framework based on Material Design

#44
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.

Re: A modern responsive front-end framework based on Material Design

#45
post #5

Earlier quoted context omitted.

>> 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 I'd say, keep it DRY [1]. http://en.wikipedia.org/wiki/Don't_repeat_yourself

It doesn't violate DRY. The repetition of "collection" is indicating a descendent component: https://github.com/suitcss/suit/blob/master/doc/naming-conve...

HTML provides nesting. Nesting indicates it is a descendent component. This would violate DRY.

Re: A modern responsive front-end framework based on Material Design

#46

"Generally it is wise to import javascript files at the end of the body to reduce page load time." Does this really make a difference? Even if it did, wouldn't it lead to seeing a jump in the content after the CSS loads?

Basically because of document.write(), the browser has to download and execute a script tag before it can move on to rendering the rest of page.

Re: A modern responsive front-end framework based on Material Design

#47
post #18
post #9

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.

Agreed. I'd love to see an AngularJS port of this. https://material.angularjs.org seems to lack some of the polish that this has.

You might also like http://ui.lumapps.com/ then. Rumor has it they are going to merge with that project eventually, or help out.

Re: A modern responsive front-end framework based on Material Design

#48
post #6

Earlier quoted context omitted.

Tell your lead front dev this approach isn't best practice at all. You want one collection li's to not have the style? Use an alternative class on the ul: "collection collection-alt". You want nested li's to not inherit the styles? Use ".collection > li" in your CSS. In any case, assigning a class on each li goes exactly against CSS best practices, because it prevents taking advantage of the inheritance of property v…

I don't agree with this. Do you have some references about your statement. I think the whole community went to separating the HTML tag names from the styles and work only with class names [1]. If you start styling your tags directly it imminently increase the code debt if you scale. Let's say you just want to add another element inside the tag. I can give you example : .collection > li { color: red; } and later on yo…

If you flip the order in which those styles are declared it will work (actually should work either way; I thought a specified class override a html targeted style while in the same context).

A class denotes something special. You don't need to repeat yourself here. The best way to eliminate side affects is by doing explicit targeting so your CSS only does what you say it can and nothing else.

html > body > div.header > h1 { color: #FFFFFF; }

Re: A modern responsive front-end framework based on Material Design

#49
post #17

Earlier quoted context omitted.

>> I think the whole community went to separating the HTML tag names from the styles and work only with class names [1]. I don't usually nitpick but I don't think one link is representative of the `whole community`. Just this thread seems to prove it's pretty divided on the issue. What is the recommendation, then? .collection .collection-item .collection-item-anchor? Genuinely curious here.

References : [1] http://www.smashingmagazine.com/2011/12/12/an-introduction-t... [2] http://bramsmulders.com/how-i-improved-my-workflow-with-smac... [3] https://github.com/davidtheclark/scalable-css-reading-list I don't usually reply in this way, but this way of writing CSS has been proven to me in many hard to predict situations and is something that I would fight for in every possible way, everywhere I can. :D I've…

* "and is something that I would fight for in every possible way, everywhere I can. :D"

At my last job, fighting about CSS and dev processes sometimes overtook actual coding and design. I'm glad to be free of control-freak colleagues. Smart and nice control-freaks, but control-freaks nonetheless.

No matter how you sell it, what you have here is a css tautology. It's a "list item", the element name is right there for all to see and use, including the machine. Yet, the first thing you do is give it a new slightly similar name "collection-item". And then the very next item you do it all again. And then to justify it all, call it "OOCSS" like it rolls off the tongue.

The machine blinks but renders your tautology anyway. The machine has no say in what is the most sensible approach.

On another example, let me say: There's nothing wrong with "#sidebar h3".

A typical house might have a garage at the side. Still part of the house, but different and permanent enough to have its own ID. It has furniture inside, as does the house. But garage furniture serves a different purpose. The point is, #main and #garage are perfectly fine and make a lot of sense. "Skinning" and code re-use can be achieved in different ways using CSS. As long as there's a coherent logical approach, you can have skinning, performance and a maintenance friendly site without ever touching frameworks. The other thing is that repetition of some code is not a problem. We don't need to be OCD about a handful of repeating CSS rules. There is not usually any progression into wild, unruly CSS just because a few repeats are found here and there.

Funny but ugly (and irrelevant) stuff in the smashingmag website HTML code...

CSS used "out of the box" is production-ready, and can perform incredibly well in all sorts of environments. CSS grids can be useful, but are not necessary. That's my opinion based on several years working in this area.

If you think "CSS grids gone wrong" isn't a thing, then think again. I'm talking about long term maintenance of the site where the "grid" becomes this "thing that someone installed ages ago that may or may not get the special attention it requires in future". Grids are needy, they have dependencies that may get compromised over time depending who is working on the site and how the design evolves. They have limitations, and they have underlying complexity that works to give the illusion of simplicity. Personally I prefer my illusions in the content, not the code.

Re: A modern responsive front-end framework based on Material Design

#50
post #6
post #3

Earlier quoted context omitted.

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 mom…

Tell your lead front dev this approach isn't best practice at all. You want one collection li's to not have the style? Use an alternative class on the ul: "collection collection-alt". You want nested li's to not inherit the styles? Use ".collection > li" in your CSS. In any case, assigning a class on each li goes exactly against CSS best practices, because it prevents taking advantage of the inheritance of property v…

There are performance considerations as well. Using selectors is more performant than raw tags.

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writi...

Using nesting and tags is less performant than classes. So using more classes is better than less.

Post reply on HN