Thoughts From Eric Archive

Growing Up

Published 18 years, 1 month past

“Daddy, when will my baby brother or sister get here?”

“Soon, sweetie.  We don’t know exactly when.”

“Tomorrow?”

“No, probably not.”

“The tomorrow after tomorrow?”

“Probably not.”

“But when my baby brother or sister comes, they will be a baby.”

“Yep.  A tiny little baby.”

“I were a little tiny baby a long time ago.”

“That’s right.  Everyone starts out as a baby.”

“Even Mommies and Daddies were babies a long time ago.”

“Yep, even Mommies and Daddies.”

“Everybody is a baby and then everybody becomes a big kid.”

“You got it.”

“And then everybody grows up.”

“That’s right.”

“And then everybody dies.”

A late afternoon breeze quietly rustled a few leaves above our heads.

“Yes, sweetie.  Everybody dies.”

“You will die.”

“Some day.  But probably not for a long, long time.”

“I will die?”

A bird chirped in a nearby tree, fell silent, and then chirped again.

“Yes, Carolyn.  Some day.  But not for a long, long time.”

“Daddy?”

“Yes?”

“Where will I go when I die?”

“Nobody knows, sweetie.”

“Will I go someplace new?”

“Nobody knows, sweetie.”

“Then what happens to me when I die?”

“Nobody knows that either, sweetie.”

“Nobody?”

“Nobody.”

“Why not?”

“That’s just the way things are.  Nobody knows what happens before we’re born or after we die.  A lot of people think they know, but nobody really does.”

“I were someplace else before I were born?”

“Maybe, sweetie.  I don’t know if you were somewhere or not.  I don’t think you were.”

“Did you take pictures of where I were before I were born?”

“No, Carolyn.  It isn’t someplace we can take a picture of.  There may not even be a place at all, so there’s no way to take a picture of it.”

She leaned forward slightly on the bench beside me, intense thought written in her small frame.  The chirping bird flew off to some other part of the yard.

“Daddy?”

“Yes, sweetheart?”

“I will not die until after I’m all done growing up.”

“Good.”

Good.


Surface Tunnels

Published 18 years, 1 month past

So Microsoft announced a touch-surface interactive computing device called “Microsoft Surface“—gee, now there’s a creative name!—and practically everyone in the known universe has gone crazy over it.  Eh, I don’t know.  I might be interested, but only if they can get the proper environment running on it, as pictured here.

A picture of a Microsoft Surface unit with Ms. Pac-Man Photoshopped onto the display area, thus recalling the tabletop Ms. Pac-Man arcade games of yore.

Oh, c’mon.  You know it’s the first thing you thought of too.


Ordering the Link States

Published 18 years, 1 month past

Spend any time at all writing above-beginner CSS, and you’re going to come across the “link-visited-hover-active” (LVHA) rule.  This holds that the four link states should always be listed in that order, like so:

a:link {color: blue;}
a:visited {color: purple;}
a:hover {color: red;}
a:active {color: yellow;}

Masters of the dark arts of specificity know why this rule exists and how it does or doesn’t apply, but if you’re still a padawan in these matters (or just rusty), you can get a quick refresher from this old chestnut of mine.

Now, it’s the case that this will become less of an issue over time becuase IE7 supports (and one presumes future versions of IE will continue to support) chained pseudo-classes, like a:link:hover {color: red;}.  Once you start chaining those you transcend a lot of the specificity-ordering concerns that drive the LVHA rule.  However, we’re not there yet.

Which brings me to the point of all this: the fifth possible link state, :focus.  Assuming we’re going to avoid chaining pseudo-classes for a while yet, but that we want to introduce link-focus styles, where should it fit in the ordering?  For the purposes of this discussion, assume the following:

a:focus {color: orange;}

a:link {color: blue;}
a:visited {color: purple;}
a:hover {color: red;}
a:active {color: yellow;}

We need to move the a:focus rule so it has a visible effect.  But where?  Should it come before a:hover, after a:hover, or after a:active?  In other words, which states’ styles should the focus style overwrite?

I’d like to hear your thoughts on the matter, and especially the rationale driving your answer.  Accessibility experts are particularly welcome to weigh in, but it’s anyone’s game here.

(Postscript: I know that many problems can be avoided by picking a different styling effect for the focus style, like a border or outline, or boldfacing or italicizing the text of a focused link.  Still, some people will want to handle everything through color, regardless of the problems this can cause for the colorblind or images-as-links, and I’d like to address that specific situation.  Thanks.)


Eventful

Published 18 years, 1 month past

Buried under some halting attempts at massive data processing and an unexpected return to battle with a credit card processor, I completely failed to mention that An Event Apart Seattle sold out and An Event Apart Chicago opened for registration.  Apologies.  If you want to be there for Chicago and our fabulous speakers, don’t wait—if current trends hold up, we’ll be sold out in a month.  (Note: no warranty is expressed or implied by this statement; past results may not be indicative of future performance; not a flying toy; etc., etc.)

In other event news, the d.Construct site has gone sort-of-live, and I mean that in the best possible way.  Go check it out.  I really like the concept they’ve got going there.  My only (tiny) critique is that some of the things that are links aren’t obvious enough—I thought at first that the navbar was all placeholders, and not actually working yet.  I was wrong.  Love the speaker photos!


Avast!

Published 18 years, 1 month past

Nick Finck just pointed me at his latest Flickr contribution—a screenshot of a site that ripped off the design of Digital Web.  I immediately tagged it “piratedsites” in honor of the late, great pirated-sites.com, figuring that doing so had to be a widespread practice.  In fact, no: only one other Flickr image had that tag, and it was a Zeldman original, and it was not a screenshot.

So I hereby propose that anyone who posts a site design ripoff shot on Flickr or a blog tag it “piratedsites”.  The original site may be gone, but the idea can absolutely be reborn using the social tools we already have.  Technorati, for example, would start pulling together screenshots and blog posts using that tag—and there you go.  Or someone could use the Flickr and Technorati APIs to create their own site dedicated to just this sort of thing.  Heck, it might even be a way to get the actual pirated-sites.com back on the air in its original form!

Out the scurvy dogs!  Arrrr!


Formal Weirdness

Published 18 years, 1 month past

As I described and tweaked my version of reset styling, a fair number of people asked (with varying degrees of politeness) why I didn’t just use a universal selector instead of that big ugly grouped selector.  I said that I wanted to avoid styling form controls (inputs, textareas, and so on), and the only way to do that, given the state of selector support in today’s browsers, is to list all the elements I want to reset while leaving out those I don’t want to touch—like all the form controls.

This led to a fair number of questions as to why I’d bother avoiding form controls, and I said it was due to their “inherent weirdness”.  By this, I meant that form controls are impossible to describe with current CSS; and if they were treated the way CSS says they should be, we’d all hate the results.  Furthermore, the handling of form control styling is going to be a very unstable branch of our field for the foreseeable future.

Herein, I scratch the surface of this entire mess.  Fair warning up front: this is going to be a long one.  Also, as Bette Davis once proclaimed, buckle your seat belts: it’s going to be a bumpy ride.


Let’s start with a (seemingly) simple form element: a checkbox.  Here are two in Firefox, one checked and one unchecked.

All right, now here’s a question: what should happen if I assign these checkboxes padding: 10px;?  Take a moment and think through the details.

“That’s an easy one,” you may say.  “There’s 10 pixels of padding between the checkmark and the borders of the box.”  And maybe you’re right.  But let’s consider the same question for these checkboxes from Safari.

Notice how the checkmark hangs jauntily out of the box?  If we add padding, does the checkmark become contained within the box—in other words, does the checkmark stay the same size while the box visually expands—or does it stretch in size so that it’s still sticking out of the box?  You don’t even have to think about what to do with the drop shadow or the glassy beveled highlight effect; just worry about what to do with the checkmark.  Again, take a few moments to think through all the implications.

All right, you should have an answer by now.  Bully!  The sad truth is that no matter what you’ve decided, you’re wrong.  Okay, I admit that’s unnecessarily harsh:  more properly, you aren’t right.  You can’t be, because there are no defined answers to these questions.

Thus, if a browser lets you style a form element, it’s doing so blindly, from a specification-compliance point of view.  The people who wrote that browser code were guessing.  No doubt they were intelligent guesses, but they’re guesses all the same.

So why not just define the answers?  That turns out to be a good deal trickier than we might hope.  Take checkboxes (please!).  They’re replaced elements, right?  You have an input element that ends up placing a symbol, in much the same way an img element places an image file.  The symbol changes based on whether the checkbox has been checked or not, something like a JavaScript-driven image-swap.  The appearance of the checkbox isn’t defined in any way, so browsers are free to do whatever they want, as we saw above.

That means that the “interior” of this kind of input element—the checkbox (filled or not)—is a black box from a CSS point of view.  There’s nothing in the document structure or content that represents the actual checkmark, for example.  You can’t in good conscience define the checkmark as content and the checkbox as the element that surrounds it.  So should padding apply at all?  Maybe.

But if it does, and the checkbox is a replaced element, then defining a background color and padding for the checkbox would put the defined background color around the symbol—the whole symbol, checkmark and checkbox and all—instead of inside the checkbox.  That’s a completely reasonable conclusion given the assumption that the checkbox symbol is replaced.  It’s just completely unreasonable if you’re a visual type and you want that checkbox to be filled in with red, for the love of Bob!

So: is a checkbox a combination of an element box surrounding content, or a completely replaced element?  Which padding-and-background effect should take hold?

Just to muddy the waters a bit further, consider the following:

  • What happens to the checkmark when the input is italicized, either directly or by inheritance?  How about when it’s boldfaced?  (Assume the checkmark comes from a font family that has italic and boldfaced versions of the checkmark available.)  What, if anything, should happen to the checkbox under either condition?
  • If text-decoration: underline is applied to the checkbox, should the whole box be underlined, or just the checkmark?  Does your answer change when you consider the effects of padding?
  • Should vertical-align apply to the checkmark, or to the checkbox as a whole in relation to the line of text in which it sits?
  • What effect should line-height have on the checkbox and its contents?  For example, what should happen if you say input[type="checkbox"] {line-height: 3em;}?  Don’t forget that the most common way for an element to experience altered line height is by inheritance.
  • Should height and width be honored on a checkbox?  If so, should they apply to the whole box, or to the “content” (the checkmark)?  If the former, what should happen to the checkmark as a result–should it stay the same size and be aligned in some way, or should its size scale along with the checkbox?

In my experience, the most common answers to these questions tend to be contradictory—some implying a box-and-content model, others implying a replaced model.  I mean, just look at the poser buried in the middle of that last point.  What does width even mean when it comes to a form control?  Is it just the content, like with non-replaced elements; or is it the whole element box, borders and all, like in replaced elements?

As far as the latest draft of CSS 2.1 is concerned, all inputs (really, all form controls) are replaced, the same as images.  So no background inside the checkbox; no change due to italics or boldfacing or line heights; vertical-align shifting the box as a whole; and height and width applying to the entire box.

You might feel that’s acceptable, overall, but remember that I said CSS 2.1 regards all form controls as replaced.  So all that would be just as true for text inputs and textareas as it is for checkboxes.  That’s probably not acceptable to most people.  For example, that would mean that vertical-align: baseline would put a text input’s bottom edge on the baseline of the text that surrounds it, instead of aligning the text inside the input with the text around it.  Almost everyone prefers the second to the first, and most browsers conform to that preference, but that’s not what should happen.  In fact, when it comes to form controls, nearly all known browsers ignore the specification’s assertion that form controls are replaced elements.

And we haven’t even touched the hard cases, like select boxes.  Here’s one from Firefox in the “closed” and “open” states.

Let’s jump straight to the obvious puzzler: what should happen if you declare select {padding: 10px;}?  Here are three different possibilities for just the closed select.

Go ahead, pick your favorite.  Got it?  Now, should the same thing happen when the select is “open”, showing all the options?  For that matter, should the same thing happen given this select box from Safari?

It does no good to say that your choice would be just fine if Safari would only just go along with everyone else.  There is no pre-defined appearance for select boxes, or for any other form control.  In Safari’s case, it’s pulling these things right out of OS X and placing them in the document—the very definition of replaced-element behavior.  (And yet, browsers keep treating them as if they’re non-replaced.)  Explorer does the same thing, actually, and is the reason why form controls seemed to have infinite z-index in IE6 and earlier—they were drawn by the OS after everything else on the document had been laid out.  Firefox, on the other hand, draws its own form controls, which is why they’re more consistent across operating systems, but also don’t suffer from draw-order issues like Explorer did.  (It’s also part of the reason Firefox takes longer to launch on many systems; rather than making use of the OS for things like form controls, it has to carry its own around with it.)

We could get into a very long discussion about whether form elements should always reflect the operating system or not, which usually breaks down to HCI advocates on one side of the debate and designers on the other.  Let’s not, though (at least not here).  Let’s just assume that form controls should be styleable, because that brings us right back to the central dilemma: how, exactly?

After all, we can make the previous select box riddle even more interesting.  Suppose you declare this:

select {padding: 10px;}
option {padding: 10px;}

Now what?  After all, there’s an option element visible there in the select box from the moment it’s drawn—or is it?  Maybe that’s a special feature of a select element that copies content from an option element to display when no option elements are visible.  We don’t know.  But let’s assume that what we see there is an option element visible inside the select element.  It’ll be either the first one in the list, or the one with a proper selected attribute.  Hey, what about this rule set?

select {padding: 10px;}
option {padding: 10px; border-bottom: 1px solid gray;}
option[selected] {font-style: italic; background: yellow;}

Yee haw!  There are a ton of questions I could pose here, but I’ll go with one of the trickier ones: should the gray option bottom border be visible inside the select box when the select is “closed”, or should it only appear on option elements when the select is “open”?  Oh, and here’s another good one: does the padding on the select element apply to the drop-down menu made up of option elements, or no?

The beauty is that whichever answers are perfectly obvious to you, it’s perfectly obvious to someone else that your answers are completely wrong.  And vice versa.

And remember, these are some of the simpler cases.  When you start considering things like how to style radio buttons and file inputs, things get really hairy.  I mean, just look at the differences between Safari and Firefox.

Merely sticking to questions of padding and background colors is vexing enough.  Start throwing in text/font styling, borders, and even foreground colors; they quickly generate a cornucopia of complex control condundra.  The pain!

And don’t think the entire issue of styling form controls is going to get any easier; in fact, the Safari team is about to make it a good deal harder.  If you read their post “Text Fields“, you’ll see that Safari will soon make it possible to do all kinds of stuff to text inputs.  (If you’re downloading nightly builds of Safari, it already allows these.)  Of the nine example images, only two have any hope of being described using current CSS—and even those have to dodge questions like exactly how a text input should be baseline-aligned (as mentioned earlier).

So in order to style form controls in any sort of meaningful way, it will be necessary to invent a whole bunch of new properties and pseudo-classes (and most likely pseudo-elements) and describe how they behave and interact.  That’s much more easily said than done.  It’s taken more than five years to not finish CSS 2.1, and that’s just a reduced and clarified version of CSS 2.  Just imagine how much longer it could take to not finish inventing a whole new branch of CSS.

Not that anyone’s really working on it right now.  The closest we have is the Basic User Interface Module, which became a Candidate Recommendation on 11 May 2004 (yes, three years ago) and has not moved since.  There is no other form controls module.  There are things that could apply in a variety of other modules (like “The box model“, “Generated and replaced elements“, and “line“), but none of them are explicitly about form controls and so their relevance is at best debatable.

In that vacuum, browsers are acting to different degrees.  As we saw earlier, Safari is pushing forward in a major way.  Explorer allows some form control styling, but not much.  Firefox allows a little more—but not all that long ago, it ignored all attempts to style form controls.  Opera blocks attempts at form styling, the last I checked.

Because there are no agreed answers, and each browser is making its own guesses, there are inevitably going to be conflicts.  If one out of five browsers uses (for example) padding to set the separation between the content and borders of text inputs, then * {padding: 0;} is going to make them seriously scrunchy, while the other four will completely ignore it.  I might then declare input[type="text"] {padding: 2px;}, but what happens when one of the other four starts applying styles to form controls, but treats padding on text inputs differently, adding padding to the default form control layout because it treats the whole interior of the input, instead of just the text, as the content?


As veterans of meyerweb have already guessed, this is not a post with answers.  Like many of my longer entries, it poses only questions and (I hope) provokes thought.  What I hope it also does is explain my aversion to applying CSS to form controls, and thus why I constructed a great big grouped selector for my reset style sheet instead of using the universal selector.  I understand why so many people want to go the universal route: it’s a lot simpler to type and uses a lot fewer characters.  I’m usually one for saving characters, but this is one case where I think extra characters are more than worth the possible cost.


Survey Reminder

Published 18 years, 1 month past
Yes, I’m alive.  So is the first-ever ALA Web Design Survey, but only for another week.  The response so far has been overwhelming, but every participant counts.  It literally takes nine minutes to finish (on average), so if you haven’t responded yet, please do!  Thank you.  And thanks especially to the more than 30,000 people who have already taken part!

Wacked Out on Goofballs

Published 18 years, 2 months past

Just so you know, assuming you care, the reset stylesheet is probably going to get a touch-up and possibly its own URL.  I made some edits here and there in the last couple of days, and almost without exception every single one was wrong.  Like, deeply technically wrong.  So I’ve stopped messing with it in hopes of not utterly ruining it.

I’m generally not one to pin my shortcomings on external factors, but in this case, I have to believe that the (over-the-counter) cold medication I’ve been taking has affected me far more than previously suspected.  I’ve been fighting an upper-respiratory soreness and cough for most of the week.  Cold meds don’t usually mess me up too much, but it would seem that taking it over an extended period has a cumulative effect.  The other night, I had a semi-feverish and disturbing dream about being afflicted with semi-feverish and disturbing dreams, and what’s creepier, the fact that I was marginally (but not fully) aware that I was dreaming the whole thing while within the dream within the dream seemed utterly normal at the time.

Also, I’m starting to get surges of light-headedness whenever I turn my head while in motion.  It’s kind of interesting.  Though not necessarily in a good way.  It also makes driving more challenging.  Scared yet?  Shouldn’t I be?

Anyway, the point being that I’m putting my thinking on hold until I get off the goofballs.  That means any further changes to the resets will have to wait, as will a mostly-completed post about form element weirdness.  The way I’m going right now, I’d probably start calling them “from elements” and then that would morph into “frum elements”, and it would make total sense to me that markup elements can be Orthodox.  And then I’d make ill-advised jokes about ways to put browsers into Sabbath mode, or something.

I probably shouldn’t even be writing this post.  If for no other reason than I’m committing a typographical error about once every three words, which ought to be a big red flag.  And it’s not like I keep up a regular blogging schedule anyway.  Still, it seems like the right thing to do.  Probably the best argument against it right now.

Nice weather we’re having, though.


Browse the Archive

Earlier Entries

Later Entries