News for hackers. Stuff that matters.
Re:Tasks That Can Be Done with Pure HTML and CSS by lugg on Monday February 11, 2019 @08:33AM (#19134310)
I am still blown away by how powerful CSS grid is.

https://youtu.be/7kVeCqQCxlk

It's sad it doesn't get more use. Potwntially this is because CSS frameworks hide all this away and nobody is really learning CSS anymore but I wouldn't really know. I'm not really that exposed to the web front end side of things.

Re:Tasks That Can Be Done with Pure HTML and CSS by danijelb on Monday February 11, 2019 @08:46AM (#19134404)
Before CSS layouts, HTML tables were (ab)used for layout and were functionally very similar to what CSS grid is now, except responsive of course. In hindsight, maybe tables for layout weren't wrong.
Re:Tasks That Can Be Done with Pure HTML and CSS by remify on Monday February 11, 2019 @08:56AM (#19134463)
Well it worked. Kind of.

What a lot of developers need to understand is that HTML shouldn't be use for layout. HTML should be use for semantic and information structure.

Re:Tasks That Can Be Done with Pure HTML and CSS by TeMPOraL on Monday February 11, 2019 @09:46AM (#19134789)
> What a lot of developers need to understand is that HTML shouldn't be use for layout. HTML should be use for semantic and information structure.

That was the great lie of the 2000s. It was oft repeated, but almost never adhered to. CSS Zen Garden was cool, but the typical attempt at "separating content from presentation" almost universally resulted in a div soup that was even worse than table layouts. If a div exists only to hang a class off it, so that it can be targeted in CSS, it's a part of layout, not semantic/information structure.

In a perfect world, in which most websites were not actively user-hostile, we could have separation of layout from content. It would include relinquishing control over rendering back to the users. It would require to stop obsessing so much over colors and layouts and custom controls. The very concept is anathema to the modern web, though.

Re:Tasks That Can Be Done with Pure HTML and CSS by dmix on Monday February 11, 2019 @12:24PM (#19136163)
> If a div exists only to hang a class off it, so that it can be targeted in CSS, it's a part of layout, not semantic/information structure.

Thanks, I've always thought this intuitively but never seen it written out.

Just as any academic theory hitting the reality through actual implementation, the theory should be more of a guiding force instead of a rigid structure to follow.

Much like how the military learned to plan battles (No battle plan ever survives contact with the enemy - Helmuth von Moltke the Elder) by giving troops higher-level objectives, rather than planning every single step of the attack, such as exactly where they should walk and hide, and expecting them to follow it to a T.

This is how I approach most programming/web design theories... including BEM.

Re:Tasks That Can Be Done with Pure HTML and CSS by Domenic_S on Tuesday February 12, 2019 @03:56PM (#19147406)
> div soup

At my last job we called it "divarrhea"

Re:Tasks That Can Be Done with Pure HTML and CSS by Frondo on Monday February 11, 2019 @11:13AM (#19135500)
The problem is that, yes, this is the ideal, but when the ideal ran up against the real world usage of these tools, two things happened, one inevitable and the other just a bad choice:

1) a small, extremely vocal group of devs kept reminding us this while the rest of us used the standards "wrong" and did fancy layouts and things,

2) seeing how most of the world used the tools we had, the standards folks didn't give us good layout tools or application development tools, they gave us CSS and it took browser vendors like Microsoft to give us XHR.

Oh what I'd give for the standards folks to have taken some time to look at the world being built around them, and then given us a better way to do that, instead of "HTML shouldn't be used for layout" for years.

I feel like, had things gone in a different direction, web development now would be as easy as VB/Delphi/Lazarus (hell, even tcl/tk) once made desktop app development. Instead, we get the soup of languages, build tools, and the confusing mess of modern web dev.

Sigh.

Re:Tasks That Can Be Done with Pure HTML and CSS by chii on Monday February 11, 2019 @09:48AM (#19134800)
So then what is used for layout? Don't say CSS, because CSS depends (somewhat) on the html.
Re:Tasks That Can Be Done with Pure HTML and CSS by haste410 on Monday February 11, 2019 @09:30AM (#19134674)
I currently still use tables everyday in my job as an email dev. Tables might not be "wrong" but they have serious limitations that have to be worked around.
Re:Tasks That Can Be Done with Pure HTML and CSS by pjmlp on Monday February 11, 2019 @08:44AM (#19134388)
Originally contributed by Microsoft, based on XAML grid.

https://alistapart.com/article/the-story-of-css-grid-from-it...

Re:Tasks That Can Be Done with Pure HTML and CSS by gog on Monday February 11, 2019 @08:38AM (#19134352)
https://caniuse.com/#feat=css-grid

This is probably the reason. There are still browsers out there that don't support it 100% to the spec.

Re:Tasks That Can Be Done with Pure HTML and CSS by dictum on Monday February 11, 2019 @09:13AM (#19134564)
There's no reason to not use CSS Grid, except for not knowing it well enough — and there's no reason not to learn it.

Of those, only IE11 is relevant, as it's a desktop browser, on wider and taller viewports.

Most of these browsers are mobile browsers on devices with narrow viewports, so even the default `display: block` fallback may be sufficient. If you have margins/paddings/widths etc which only make sense in the CSS Grid version, you can set these properties inside an `@supports` query https://developer.mozilla.org/en-US/docs/Web/CSS/@supports

For IE11, it's a choice of presenting visitors with a slightly worse layout, to match the browser (https://philipnewcomer.net/2014/04/target-internet-explorer-... or, if you use Sass or PostCSS, using mixins that output CSS Grid properties with Flexbox as fallback.

Its bugs are well-documented, and most have workarounds https://github.com/philipwalton/flexbugs. Even inline-block can serve as a fallback, if you can avoid whitespace around tags in the markup (https://css-tricks.com/fighting-the-space-between-inline-blo...)

A reasonable fallback doesn't need to match CSS Grid exactly. The whole point of media queries and responsive web design is that the website won't look exactly the same on all devices; it will look and work as good as it needs to look in that specific device.

Re:Tasks That Can Be Done with Pure HTML and CSS by folkrav on Monday February 11, 2019 @09:52AM (#19134828)
My last workplace's policy was to fully support the last couple version of Edge, Firefox and Chrome, but for IE11, it was "it won't be utterly unusable". That approach is becoming more and more commonplace, too. Reasonable fallbacks doesn't mean being perfect, either. I'll be honest anyway, most people still using IE11 these days are either literally stuck with it, or a pretty used to half the sites they visit to be a bit broken.
Re:Tasks That Can Be Done with Pure HTML and CSS by mcv on Monday February 11, 2019 @08:58AM (#19134482)
Not a lot, though. Edge, Chrome, Firefox, Safari, Opera, iOS and Android all support it. Nobody cares about Opera Mini and Blackberry, and the sooner we cut IE11, the better. It's never going to support most of the modern standards.
Re:Tasks That Can Be Done with Pure HTML and CSS by onychomys on Monday February 11, 2019 @09:36AM (#19134717)
It's not that nobody cares about Opera Mini, it's instead that OM users (like me!) have come to accept that some sites will behave in a weird way on the browser, and so it might be necessary to switch to a different one. It's the tradeoff we make to get all of the good things that come along with OM usage.
Re:Tasks That Can Be Done with Pure HTML and CSS by detritus on Monday February 11, 2019 @09:05AM (#19134518)
“Recent-ish versions of Chrome, Firefox, Safari, Opera, iOS and Android all support it”. According to my stats, there's a load of old Chrome & Safari versions using my site that would be tripped up by its use, sadly.

I'm keeping a beady eye on my stats, awaiting the day and can make a site entirely with CSS Grid.

Re:Tasks That Can Be Done with Pure HTML and CSS by tenaciousDaniel on Monday February 11, 2019 @08:44AM (#19134389)
It's not on the blackberry browser, so that's gonna be a no for me! :p
Re:Tasks That Can Be Done with Pure HTML and CSS by Theodores on Monday February 11, 2019 @12:56PM (#19136480)
> It's sad it doesn't get more use.

This is basic HTML5 literacy. At the end of the day the new HTML5 and CSS features do not fit into out dated work practices and the excuses that go with it. Web content creators and developers should be familiar with all of this stuff and not kidding themselves that the 'sea of divs is the way to go because we do really important projects and need to have polyfills back to IE6'.

Not using the new tags and not using CSS grid is a bit like only eating fast food and no longer knowing how to use a knife and fork. When I look at div soup I know that the team behind the page have not got it yet. None of the div soup HTML is maintainable. It is dated. So any 'wow you can use the details/summary' article comes across to me as 'wow, you have learned to wipe your own nose!' This whole industry needs to get to grips with the lingua franca of the web, focus on document structure, use the stuff that works in evergreen browsers and move away from big up front visual design made into div soup to content driven design. It is that simple and excuses are pathetic.

Re:Tasks That Can Be Done with Pure HTML and CSS by rangerpolitic on Monday February 11, 2019 @10:46AM (#19135216)
I am hopeful for CSS grid. I am hopeful that we can properly return to the principle of separating concerns. I am so tired of dealing with sites that have HTML littered with divs and spans solely for the purposes of layout and styling.