Live data from Hacker News

A modern responsive front-end framework based on Material Design

materializecss.com

11–20 of 96 posts

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

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

[deleted]

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

#12
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…

> CSS best practices

...don't exist. There are many competing schools of thought. In particular, BEM is a school of thought with widespread support which disagrees with your comment.

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

#13
post #10
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 dont do this repeating class business but CSS Tricks 'css guidelines' web page says that when you do : '.collection li', it first searches through the page for all 'li's then wittles it down to the ones within the correct parent. Essentially that css selectors work from right to left. So I guess the idea is that classing up the li elements within a parent may be marginally quicker? I have never bothered though. Doe…

This is true, actually. They are read from right-to-left. I'm not sure how much extra resources are expended searching this way opposed to the other, though my guess would be the same as yours. It may be worth a benchmark?

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

#14
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…

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 you add a anchor as a child you would need to force the specificy to this element

    

    .collection-link { color: blue; } // this will not work
    .collection > li .collection-link { color: blue; } // increased complexity
I would almost always advice against styling tag names, except when you are doing css reset.

1: https://en.bem.info/articles/side-effects-in-css/

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

#16

Bootstrap material design has something similar, although it is not matured yet: https://github.com/FezVrasta/bootstrap-material-design

The main issue with bootstrap-material is that this project is afflicted by the dreaded "developer thinks he needs his own license" bug[0][1].

It's effectively CC BY-SA-NC which is rather bold when you consider that it's adopting a design framework from Google for a css framework from Twitter.

[0] https://github.com/FezVrasta/bootstrap-material-design/blob/...

[1] https://github.com/FezVrasta/bootstrap-material-design/searc...

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

#17
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…

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

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

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

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

#19
post #17

Earlier quoted context omitted.

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…

>> 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 been part of large projects that if you don't follow some styleguide rules you end up with "!important" in your codebase. Which is bad.

Scalable CSS writing ( even more important for a CSS framework that you use as a base ) consists of a more modular approach to your stylesheet.

Let's say you have a list I would usually do it :

    
      
        
      
      Normal Text
    
By doing this I can safely remove the .button, code ( module ) and put it somewhere else on my page without affecting how it will look like. Something more if I feel that I have a totally different link in this exact place, well yes. I would call it '.collection-item-link', because '.special-fancy-link' isn't semantic at all.

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

#20
post #3
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...

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…

I've come to expect people who criticize others using "best practice" as their "source" are themselves not very good at what they do and are just cargo-culting ideas without any real understanding in underlying principles.
Post reply on HN