This resource .. showcases a number of techniques.
That's kind of the point.. you should not need to have a page to showcase different techniques for something this basic.
I, for one, does not have to deal with this. But as and outsider it seems strange that simple things are so hard. Maybe web developers have gotten so used to dealing with things like this that they don't see how convoluted it is?
As a designer and client-side dev, I've been using CSS and HTML for about 9 years. A lot of the weird edge cases and nuances are second nature to me now. However, if you step back and look at it all, it's pretty goofy, but then again, so is English. But I'm going to keep using it, because there isn't anything else. At this point, I'm really good at it anyway and this stuff doesn't really bother me too much.
I see what you're saying and I agree it would be great to be simpler. My perspective is that the complexity is actually in the flexibility in CSS and the number of options provided to you. I'm not sure how I'd make it simpler without removing some of the control.
>My perspective is that the complexity is actually in the flexibility in CSS and the number of options provided to you
Not really, most of the complexity is of the ill-thought design they started with, and the LACK of options for certain things.
Initially the envisioned CSS as a styling technology, so layout was an afterthought. Even the messy floats hacks (those one that replaced tables) wasn't something that was though of specifically as a complete layout solution.
We had to wait 10+ years, to have actual layout solutions catering to the needs of web designers: Flexbox, Regions, Multi-Column layout and Grid Layout -- and of course those are still not implemented totally by browser vendors, give a few years wait for that too.
The use "currently" itself should set of a number of alarms in a sane person.
Then, to top it, you add: "showcases a number of techniques".
Centering should be an built-in, simple, capability. As simple as making some div red or adding a 2px border.
Not a "technique" or a "workaround" and surely not "many of them" (incompatible and each with different tradebacks).
You don't see "techniques" for making divs have a certain background color -- that's because there's a single instruction for that, and it bloody works all the time.
I find centering more complex because there's not just one type of centering. I think centering can differ based on fixed and fluid width, display type of element (inline, inline-block, block), and probably other factors. I can't think of a clear definition for how a single simple centering would work given all the possible variables at this point.
I agree with gizzlon. The inline-block versions are the closest things to actually saying "put this block in the middle". For a system that claims to be all about layout, it shouldn't be so obtuse to say "stick this, whatever this is, in the middle."
Also, auto-flowing text split between columns as a "column" property of some kind would be nice.
The list you provided is handy, but it shouldn't require knowing that you have to look up specific cases.
[edit: I appreciate the constructive example, should've mentioned that.]
Which unfortunately looks like crap, as there is no (standard) way to get browsers to hyphenate words in a sane way :-(
[edit: I wish CSS Regions was (or was likely to become) a viable solution, as it actually does what a lot of people want: a sane and standard way to lay out text, based on experiences from dtp. Sadly, afaik, it's unlikely to be accepted, and I'm not sure if there's even a decent way to get it to work with a polyfill (suitable for production):
In theory css-regions along with hyphenator or hypher should be enough to have layouts that are both semantic, look good, and are simple to implement. It's been a while since I tried to get it to actually work, and I don't remember it as "just working" (that would include proper pagination both on small screens and on print outs, without too much effort):
> For a system that claims to be all about layout, it shouldn't be so obtuse to say "stick this, whatever this is, in the middle."
Ah, but unfortunately CSS isn't about layout at all. Hence proposals like css-regions (see comment below) -- which are about layout. It's a common mistake: We came to html (with our designer hats on), and thought: Oh, we can layout text with tables! We were wrong, and we got css -- and we thought: Oh, we can layout text with CSS -- but we were still wrong. We could do some minor (and as it turned out pretty major) styling with CSS -- but it was never really meant for layout. We do need a system for layout, and perhaps the most sane thing to do these days is to wrap CSS into a tool that does styling and layout. But CSS of today isn't quite there.
"This document specifies level 1 of the Cascading Style Sheet machanism (CSS1). CSS1 is a simple style sheet language that allows authors and readers to influence the presentation of HTML documents. E.g., a publisher can suggest font families, colors and layout for a document, while the reader can ask for the document to be magnified. By attaching style to HTML elements, document structure and device-independence is preserved."
Over-eager use of emphasis mine. While it contains the word layout, it's set in the context of HTML documents -- and I think that was a mistake. Still it brought us forward from what things was like before the mid 90s!
There's an old phrase that the bad workman blames his tools and it seen to apply here too. It's really not difficult and why complain about it being obtuse? If you understand the fundamentals then it makes sense. As for the last sentence well the list he provided is only for people that need to look it up (like you) - that's like me saying to my car mechanic that I should have to look up where the fuses are in the car. If you don't know something you have to look it up (taking what? .4 seconds on google?) - if you knew it you'd obviously not have to look it up. Stop whining and learn this stuff.
I'm glad you get to work in UI-world all day long that CSS' idiosyncrasies are something you can memorize inside and out. Personally, I'm required to know a lot more about mathematics and databases. My clients can deal with not-very-pretty UI, they can't deal with lost or incorrect data.
But if you want to make analogies about tools, one should always use the right tool for the job and not employ hacks. To me, "margin:auto" is a hack. It doesn't express that the object in question is being put in the middle of something else. It hides the intent of the action behind insider jargon. Or, to continue your analogy, it's using the handle of a screw driver to hammer in a nail.
>There's an old phrase that the bad workman blames his tools and it seen to apply here too.
Not all of us are "workmen" here, that have to get used to our tools, etc.
Some of us are actual scientists and engineers, with lots of experience in identifying broken APIs and tools. Some of us even PROGRAM the tools you get to use, from CSS implementations in browsers to editors and such. Heck, there are people on HN from Mozilla, Google, Apple and MS.
CSS, with regards to layout, has been broken from the start.
That's not up for debate just because someone has mastered all the intricasies. Even the original authors and the W3C agree and have taking corrective steps in later CSS versions (still not widely supported).
So "Stop whining and learn this stuff" is not really an answer in a technical debate.
Nice job. Is it a problem with the state of webdev that the thing I was most impressed by was that your website didn't break my back button? Seriously, good work.
Well, that's a nice feature, but as you bring it up, deep linking isn't possible ;-) There are various techniques to enable it though, pushState(), hash fragments etc.
I believe it is a side-effect of the keyboard navigation. It appears to support the back button (due to the script listening for the arrow keys and disregarding the Alt-modifier) but only for those users who use the keyboard to navigate back-and-forth in history. If you observe carefully, the actual "back button" isn't activated (and hence useless).
These are really very nice, but they don't really convey any more information than a static picture of a puzzled kitten. Like "security theater," this is "progress theater" and I would prefer to give my users a more useful indication of progress. I do appreciate the work that went into these, and admire the skill.
>I would prefer to give my users a more useful indication of progress
Those are called "indeterminate progress indicators".
Not everything on the web has some specific state info or progress percentage to declare.
Just showing that "something is running" is still very useful for those situations, and can have a huge impact on the users perception of the page responsiveness.
(As has lots of other "theater", which is not to be dismissed -- e.g the mobile practice of showing a screenshots of the apps last state while you load it, making the user thing it loaded faster).
I agree that what you prefer would be ideal, however a lot of things that happen on the Web isn't conducive to a real "true current state of progress" loader. Actually, a lot of things that happen even on local machines are not possible to be determined in an absolute sense. That's why most progress bars seem to progress in fits and spurts, not in smooth consistent amount over time... I think this is due to some tasks just take an indeterminate amounts of time. In those cases, a progress bar isn't much better than a numbered list of things shown as "to do" and "done." In the case like client server request response, which may be asynchronous, where responses are only received when it's "done" then it makes sense why these cannot show progress... Just that it's "still waiting." Not ideal, but I can't see a better solution that doesn't require sending multiple updates back saying "still not really sure when we'll get to your request" or "just fetched stuff from the dB, 2 more tasks to do."
Here is a little editing on one of the ones I like this better then the three in a row.
.spinner {
margin: 100px auto 0;
width: 70px;
text-align: center;
}
.spinner > div {
width: 22px;
height: 18px;
background-color: #333;
looks like a problem with my chromium as firefox is almost idle when displaying the indicators.
(30.0.1599.114 Developer Build 30.0.1599.114-0ubuntu0.12.04.3 x86_64)
I think you're mistaken. The first example is only ~700 bytes in size. Show me an animated GIF, with those dimensions, that many frames (to maintain that level of smoothness), for under 700 bytes?
(HTTP overheads are not factored since HTML + CSS is one less request than HTML + CSS + Image resource.)
We're using something similar to this in our current project. We have a fallback to a classic animated gif if animations aren't supported. I'd guess we're not the only people doing this. Wrote it up here: http://icanmakethiswork.blogspot.co.uk/2013/04/a-navigation-...
You might have more luck getting this to work than animating SVG files; which doesn't work in any IE version, and has issues in Safari and iOS Safari, and old versions of Android (Pre 3.0, but damn, they are everywhere).
On a project that targeted tablets (iPads and Androids), we eventually went back to good ol' gifs because of how bad SVG and CSS animations rendered and performed.
With Backbone.js: I usually just hide all views except for my "loadingView" (which is usually just a simple HTML element with a spinner/translucent background/etc.) while I'm retrieving data. When my data arrives, I hide the "loadingView" and display the data as usual. There are probably better approaches, but it works for my projects. Hope this helps.
(Nice work, btw, like the animations =)