News for hackers. Stuff that matters.
Re:Ultra minimal CSS grid utility by Breefield on Thursday June 30, 2011 @02:25PM (#2715158)
Am I the only one that doesn't understand everyone's obsession with CSS grids? I mean, I understand why grids are an important part of design, don't get me wrong. I use grids and I try to adhere to a baseline, but I don't actually formalize this into my markup. I keep that formatting strictly in the CSS. If you're going to use a CSS grid, this formatting spills over into your HTML via those dorky ambiguous classnames that really remind me of Dreamweaver.

I'm sure this "grid.css" is great, really concise, etc. But do we really need to be using it? I like to type out comments on HN and never hit "add comment," today I will.

Re:Ultra minimal CSS grid utility by clutchski on Thursday June 30, 2011 @04:09PM (#2715542)
"Am I the only one that doesn't understand everyone's obsession with CSS grids"

I saw a great talk by Nicole Sullivan on CSS last week. She said that many sites lack a meaningful high-level abstraction for their visual layout, and end up with a tangled mess of float, padding & margin declarations on every element. This complexity, she said, is more clearly and concisely handled at a higher, site-wide level and suggested using a grid.

I've wasted an insane amount of time pushing one element four pixels this way and another element three pixels that way, so I'm definitely eager to try a grid on my next project.

Links to her slides (with some other great info) and her grid framework:

http://www.slideshare.net/stubbornella/our-best-practices-ar... https://github.com/stubbornella/oocss/blob/master/core/grid/...

Re:Ultra minimal CSS grid utility by bgrohman on Thursday June 30, 2011 @08:13PM (#2716324)
I think a high level abstraction with semantic meaning is important. If you want to include the layout styles in that abstraction, that's one thing. But if you want a simplified way to set the layout without building the grid system yourself, what choice do you have besides including layout-only classes on your html elements?

So I agree with Breefield that it's not optimal to have separate class definitions outside of your high level semantic abstraction for the sole purpose of layout. But I don't know of any other way to do it other than just building the grid into your abstraction, which means you can't reuse existing css layout systems (unless you just copy the code... ick...).

Re:Ultra minimal CSS grid utility by ianterrell on Thursday June 30, 2011 @02:42PM (#2715226)
I can't speak for all the options, but Blueprint has for quite some time now had a "semantic" option where a Ruby script generates the appropriate CSS based on your input.

Using that you can still think of things in a logical grid format rather than pure CSS (i.e. 3 columns wide, rather than 80px), but keep your HTML clean.

See the "semantic_classes" option: http://joshuaclayton.me/blueprints_compress_a_walkthrough.ht...

Not to mention if you use Compass you can do the same thing with their Blueprint mixins: http://compass-style.org/reference/blueprint/grid/

Or if you use Less: https://github.com/omnifroodle/blueprint.less

Re:Ultra minimal CSS grid utility by SingAlong on Thursday June 30, 2011 @11:54PM (#2716981)
I was just searching for the sass/scss version of Blueprint. Is there one available? I don't want to use Compass just for Blueprint. Compass is almost broken with rails 3.1 and there's a lot of confusion.
Re:Ultra minimal CSS grid utility by ianterrell on Friday July 01, 2011 @10:08AM (#2718375)
Re:Ultra minimal CSS grid utility by tjpick on Thursday June 30, 2011 @04:31PM (#2715629)
it's the typical developer response, that all concepts, no matter how abstract, should be captured in Code.

In saying that, it's easier to shove a bunch of classes into your html, and that's kind of what the multipurpose class tag is for. As to whether the binding should be done via css selectors or via html classes... well, I think the appropriate phrase is "6 of one, half a dozen of the other".

I've done most things both ways at some stage or another, and the maintenance is the same, the complexity is the same, and there's an advantage to having a label directly on the html node, that tells you what the hell is being applied to it.

Re:Ultra minimal CSS grid utility by thatcoolguy on Thursday June 30, 2011 @07:01PM (#2716083)
I totally agree.

Grid systems are great, but not in the way they're being used today - with lots presentational of classes and ids in the markup.

Are we going back to the days of tables for layout? Look, classes like span-x, grid-y, append-x describe only the presentation of the content. I thought HTML was meant to describe structure, not layout.

Grid systems are destroying the semantic web.

EDIT:

Other classes-littered systems aren't any better (OOCSS, I'm looking at you).

Re:Ultra minimal CSS grid utility by malnourish on Thursday June 30, 2011 @03:47PM (#2715481)
I haven't had much utility for it, but I did just realize a useful feature of grids.

I found that you can select (and therefore copy) all text in a paragraph in one grid, while keeping the text in another paragraph unselected. While this doesn't have any immediately obvious uses to me, there is still some merit.

Screenshot: http://i.imgur.com/uycBt.png

Re:Ultra minimal CSS grid utility by astrofinch on Thursday June 30, 2011 @05:07PM (#2715739)
"If you're going to use a CSS grid, this formatting spills over into your HTML via those dorky ambiguous classnames that really remind me of Dreamweaver."

Not if you're using Compass with its mixins: http://compass-style.org/examples/blueprint/grid/two_cols/

Re:Ultra minimal CSS grid utility by fourspace on Friday July 01, 2011 @12:20AM (#2717040)
I use Compass/SASS with the 960gs grid system, allowing me to create purely semantic HTML while the layout remains in CSS. Using a grid system doesn't necessarily pollute your content.

https://github.com/chriseppstein/compass-960-plugin/

Re:Ultra minimal CSS grid utility by kmfrk on Thursday June 30, 2011 @02:35PM (#2715194)
I think people should remember why they use grids in the first place and not just jump on the grid bandwagon, just because that's in vogue.

I love using a grid, but it serves a purpose for me, and I do it all in the CSS without creating a dozen of "clearfix" and "column1" classes and whatnot.

Re:Ultra minimal CSS grid utility by voidfiles on Friday July 01, 2011 @12:28AM (#2717061)
Grids are great at building structure with a minimal amount of CSS. Especially when you use a recursive grid system. It just makes sense when you are trying to make small performant website.
Re:Ultra minimal CSS grid utility by beck5 on Thursday June 30, 2011 @02:41PM (#2715221)
a couple of reasons I think we see so many

1) the development time / potential number of users ratio is attractive for a developer (easy 100+ watchers on github etc) 2) many people have built their own grid system over the years and feel like sharing them, documenting it and putting it on github isn't hard.

Re:Ultra minimal CSS grid utility by BasDirks on Thursday June 30, 2011 @03:05PM (#2715322)
I don't see the use either. I don't need crutches for something as basic as lay-out. DRY is fine, but not if YAGNI.
Re:Ultra minimal CSS grid utility by zyb09 on Thursday June 30, 2011 @04:27PM (#2715610)
As far as I know, there's some holy war against <table>s going on, so people rather write tons of obscure CSS code, which becomes instantly impossible to understand the moment you write it and probably renders 10 times as slow in any browser, than to just use tables.
Re:Ultra minimal CSS grid utility by pistoriusp on Thursday June 30, 2011 @05:01PM (#2715720)
I had to do a double take on your comment because that holy war ended a very long time ago and with very good reasons.

Here's a pretty good summary: http://stackoverflow.com/questions/83073/why-not-use-tables-...

Re:Ultra minimal CSS grid utility by jules on Friday July 01, 2011 @05:44AM (#2717659)
The responses that use valid arguments (i.e. not "it will harm your professional reputation to use tables! or tables are for tabular data! or I can bill more hours if I use CSS!") pretty much agree that the arguments against tables don't hold much water.

The only argument that might be important against tables that I could see is that they work less well with screenreaders. Can anyone using a screen reader confirm or deny this? I could easily see it being the other way around, because with tables a screen reader will let you quickly navigate to different parts of the page (e.g. sidebar to header to main content by going left, right, up and down instead of painstakingly navigating over a bunch of text).

On the other hand, tables are easier to use, more flexible, more predictable across browsers, and more readable. Just look at the years and years of research it took the CSS experts at e.g. Alistapart to replicate layouts that are trivial with tables using CSS.

Examples:

http://www.alistapart.com/articles/fauxcolumns/

http://www.alistapart.com/articles/fauxabsolutepositioning/

http://www.alistapart.com/articles/multicolumnlayouts/

http://www.alistapart.com/articles/negativemargins/

And even then it doesn't always work: http://www.satzansatz.de/cssd/hgjump.html

Note that these layouts are utterly trivial to create with tables.

Re:Ultra minimal CSS grid utility by tonyarkles on Friday July 01, 2011 @12:21PM (#2718936)
They also don't work very well if you're trying to build a site that looks decent on a mobile browser... You can do some cool CSS tricks to facilitate different screen sizes. See http://cssgrid.net/ for an example (resize your browser window and see how things change)
Re:Ultra minimal CSS grid utility by proexploit on Thursday June 30, 2011 @06:21PM (#2715961)
I think of tables as a shortcut and they do cause actual problems in the future even if they work for you. I think the bigger issue here is that it isn't clear to everyone how to code with CSS. I use tables only for tabular data but my HTML is clean, fast and certainly not obscure. I would say in most cases I can create an tableless design in less lines of code and have a much easier time maintaining or updating it in the future.