Hacker News new | ask | show | jobs
Bulma: Modern CSS framework based on Flexbox (github.com)
146 points by dkannan 3791 days ago
9 comments

Did a quick pass of the docs, and the grid system seems to be opinionated/unconfigurable w/r/t changing column ratios as device width scales. Everything is 100% width at mobile size, and once you pass that breakpoint, there's no adjustment mechanism at any other size.

That's a big step backwards from bootstrap's col-breakpoint-width, IMO.

It also fails to address nesting columns within each other.

This feels more like a rudimentary grid system that happens to have some button styles, rather than a "framework".

If you want a bootstrap-like grid experience with flexbox and sans the bloat, I've had a decent experience with this: http://flexboxgrid.com/

Foundation Sites (F6) also comes with flexbox grid btw. It's optional, you can switch it on in the sass settings and use the same html markup as before.
Yeah http://bulma.io/documentation/grid/ could definitely use some improvement for different screen sizes, but the rest is very well styled...
Do you have a a good resource for some bloat to go with that grid experience as well?
I haven't found a way to handle <aside> with Flexbox.

Intended behaviour is that you're writing paragraphs of <p>, then a <p> that you wish to annotate, then the <aside>, then some more <p>.

The aside should be, well, on the side. In the margin.

So far, with floating <aside> you need to have the <aside> before the <p> that it belongs to, which is semantically false.

I had hopes with Flexbox to finally solve this issue, but it doesn't look possible, because if you imagine it as a big grid of two columns, the text would have to flow through only the left column, while only the <aside> would have to be pushed to the right column.

Is this what you're looking to do?

https://jsfiddle.net/sadz6va6/

Disclaimer: New to flexbox myself. Might have committed some sins.

Yes. Thank you (also to the sibling commenters).
Nicely done.
If you use margin: auto on an element inside a flex container (for example margin-left:auto to float right), you can position a floated element in correct content order.
Wouldn't row-reverse fix that?
Am I the only one who doesn't understand why every single piece of code needs to be installed through npm?

Even css? Come on!

There's nothing forcing you. The code is right there in the repo. You're welcome to download it via Github's download button, cloning via git, or NPM. NPM is a very helpful option because it's the fastest and easiest way to get it into my project and not have to copy and paste stuff around either from my OS UI or command line. Just `npm install` then possibly writing a line in a gulpfile to copy the css where I need it if using unaltered.
In this particular case it's because Bulma is using node-sass as a precompiler. I'd wager a guess this is true of most CSS packages that you're finding on NPM. Additionally, it's more pleasant to use than Bower (in my humble opinion).
I blame webpack.
Just as popular JavaScript libraries spawn many superfluous forks and microframeworks, the landing of Flexbox has resulted in dozens of these CSS 'frameworks' and grid systems:

1. http://basegui.de

2. https://github.com/ButaneCSS/butanecss

3. http://juicedcss.com

4. http://bowlingx.github.io/flexcss

5. http://codepen.io/geoffyuen/pen/ogrPbZ

6. https://github.com/meerita/flexsasscandy

7. http://getmdl.io/components/index.html#layout-section/grid

8. https://kevinpy.com/Projects/Flexo

9. http://philippkuehn.github.io/gridilydidily

10. http://stylusgrid.com

11. https://github.com/IonicaBizau/gridly

12. https://github.com/colourgarden/avalanche

13. https://milligram.github.io/

14. https://github.com/ButaneCSS/butanecss

15. http://bulma.io/documentation/grid/

16. http://gridlex.devlint.fr/

17. http://crabcss.com

and that's but a fraction of the full list.

I haven't bothered to sit down and actually assess whether these flexbox grids actually differ from each other (my gut says that it's not possible for them to differ too much). My gut also tells me that there has to be an apex, an optimal Flex-based grid from which there can be no improvement.

I think a big part of the problem of why websites all look a bit similar is because they're all developed using Bootstrap, Bourbon or Foundation, and apparently on the rare occasion where a front-end framework is not used, an offshoot or "heavily-inspired by" alternative is used instead.

Nobody is thinking about what /could/ be, but rather what can be done in the least time to produce the best approximation of a contemporary website. Nobody wants to push the boundaries. Maybe we've reached an optimal paradigm for the design and layout of websites. I don't think so.

I always implement my own CSS, mainly because I really don't like carrying frameworks around. If I need all of a framework's features, I'll consider using it. Since I never need all of a framework's freatures, that never happens. If I ever do need a full front-end framework's worth of features, here's a framework that seems flexible, modular and solid to me: http://www.basscss.com/

and if you want a great grid, look at this: http://peterramsing.github.io/lost/

and if you want to wait for a more powerful future grid tool, investigate the CSS Grid Spec:

http://gridbyexample.com/

http://gridbyexample.com/examples/page-layout/

http://abookapart.com/products/get-ready-for-css-grid-layout

https://24ways.org/2015/grid-flexbox-box-alignment-our-new-s... https://rachelandrew.co.uk/archives/2015/11/03/three-years-w... https://rachelandrew.co.uk/archives/2015/04/14/grid-layout-a...

If I was starting a new site today I'd roll with:

- PostCSS (with plugins: cssnext, variables, mixins, nested, autoprefixer)

- Lost Grid

- Typographic (http://corysimmons.github.io/typographic)

- Boy - if I had to support legacy browsers (https://github.com/corysimmons/boy)

ButaneCSS is pretty close to what you want. I was hesitant to add lost grid but it is easy to add to the setup.
It really comes down to dev speed. Thats why I don't write CSS anymore

I can simply sprinkle CSS classes around and then ask someone to create a Bootstrap theme for me.

IMO the optimal framework would be Google's Angular-Material, except for the fact that it is massively coupled with AngularJS for no reason. The assigning of layouts to row/columns, and dividing the space within are done very easily. Someone would be wise to use their system as the basis of a great CSS-only framework.

https://material.angularjs.org/latest/

I've looked at this for all of three minutes, but it appears that it's basically an Angular version of Masonry with a dash of flexbox.

Masonry is something I'd love to implement in pure CSS, but it's not really possible. You need to know the heights and then be able to position your grid items absolutely, it's not something that can be done dynamically without using JavaScript.

You can use CSS3 Columns, but then your content is going to be displayed in a counter-intuitive order. It works great for a photo grid or Pinterest-style site, but most cases require some kind of intuitive display order. I am especially thinking of e-commerce, where it's imperative to offer the end-user the ability to sort products alphabetically, and search results in terms of relevance or whatever.

Angular Material doesn't suffer from any of those issues because it is based on flexbox. It works without Javascript, only it hasn't been written to do that. There are two issues:

- first, the elements being selected are all angular directives like `md-content`, `md-button` -- not a dependency on Javascript but clearly targeting a JS app

- a second theme stylesheet is dynamically generated and injected into the head

None of these are strict requirements -- I've extracted the stylesheet and repurposed it for my own projects.

Before bootstrap and the like came along, all of us developers were creating web apps just as we do now. They just looked like crap! The CSS frameworks have evolved everything form "ugly" to "boring" which I guess is somewhat of an improvement!
FYI: I included ButaneCSS twice by mistake.
This can be beautiful, but I'd need SOME KIND of back-compatible functionality, even if it's just to tell old IE users "hey you're totally missing on stuff, check this out"
I've been working on a toy CRUD app in Elm, after hearing that Richard Feldman wants to 'make the backend team jealous!' and wanting to see why I should be jealous.

Anyway, I managed to quickly style it with Bulma yesterday, and I think it looks nice: https://dl.dropboxusercontent.com/u/130414/elm-doc-mgr/index...

Having previously built some medium-sized apps with bootstrap and material, this is something I'd like to try for my next project. It looks simpler than either of those other two, and has enough other stuff to make it usable out of the box, unlike something like skeleton which was too minimalist for me to use easily.

I haven't used flexbox ever myself. Could someone summarize why flexbox makes this framework effective?

Flexbox layouts "work like you think they work" for the most part, which is really nice, and far better than their predecessors.

The 3 "holy shit we needed this before!" features IMO are: vertical centering, height matching (if you have 3 columns in a row, and one has more text, all 3 columns will have the same bottom position), and the ability to evenly distribute objects across space.

check this out for more: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

caveat: flexbox support, while passably good, is still shaky in places.

the ability to dynamically fill the remaining space is also huge.
"Could someone summarize why flexbox makes this framework effective?"

Ever tried to center something vertically? Flex box does it easily. Is also makes it easier to do responsive layouts, with much simpler markup and styling.

It looks great. I think I will use it in my hobby projects instead of Bootstrap.
Flexbox is lovely, and this framework looks great...but, does it work with crappy browsers (e.g. every IE version prior to Edge)?
According to caniuse[1], IE support is janky, period.

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

IE 10 and 11 are supported with browser prefixes, so you're only losing out on 8 and 9, which constitute ~2 of all internet traffic. Some non-trivial percentage of IE 8 and 9 users have them installed only for specific websites and internal corporate sites.

There just can't be that many people browsing the web with IE 8 and 9. Additionally, we need to draw the line somewhere, especially given how much easier flexbox makes front-end styling.

Caniuse.com shows the global usage share statistics (based on data from StatCounter GlobalStats for December 2015) next to each entry.

  IE 7: 0.05%

  IE 8: 1.18%

  IE 9: 0.91%

  IE 10: 0.87%

  IE 11: 6.45%

  Edge 12: 0.67%

  Edge 13: 0%

  Edge 14: 0%
For comparision:

  Chrome 47: 20.46%

  Chrome (Android) 47: 17.45%
The full list: http://caniuse.com/usage-table

IE 8, IE 9 and IE 10 are still more widely used than Win10 with its Edge browser.

Don't use flexbox for your start page, especially if you want to do business (SaaS). It will be completely broken in IE8/9 and look like shit. Corporate managers will close your website instantly.

In practice 10 support is patchy, but can usually be fixed using the wonky old syntax and minimal hacking. For general use 11/Edge are fine.

In fact, a usable desktop view for IE9 is relatively easy to frig with %widths and a handful of padding hacks.

I just don't use Flexbox. Not in production.