Thoughts From Eric Archive

Gridded Headings v. Justified Headings

Published 7 years, 6 months past

Amongst the reactions to Gridded Headings, Benjamin de Cock pointed out there’s another way to arrive at the same place I did.  Instead of this:

grid-template-columns:
    minmax(1em,1fr)
    minmax(min-content,max-content)
    minmax(1em,1fr);

…Benjamin pointed out one could instead do this:

justify-content: center;

That’s right: without explicitly specifying any grid columns, but just setting the grid items themselves to be centered, the same behaviors emerge.  Clever!

What’s interesting is that the behaviors are not precisely the same.  While mostly identical behaviors occur with either approach, there are a few subtle differences and a much different possibility space.  I’ll consider each in turn.

First, the differences.  First of all, the small gutters defined by the first and third grid column tracks — the ones defined to be minmax(1em,1fr) — aren’t present in the justify-content version.  This means the headings will jam right up against the edge of the grid container if things get narrow enough.

Side separation versus side smashing.  Grid on the left, justify-content on the right.

So we either need to re-establish them with grid-template-columns, which would seem to put us right back where we were, or else apply side margins to the heading and subheading.  Something like this:

div h2, div h3 {margin-right: 1rem; margin-left: 1rem;}

Either way, that side separation has to be defined (assuming you want it there).  Having to set those separations as margins feels a little clumsy to me, though not hugely so.  Doing all the sizing and separation in a single grid-template-columns declaration feels cleaner to me, though I admit that may be partly due to my current Gridfatuation.

There is another difference worth exploring.  If the content gets wider than the space available, the grid-template-columns approach means the content will overflow to the right (in LTR writing modes).  If it falls offscreen, it can be scrolled to read.  With justify-content: center, the content stays centered within the box, overflowing to both sides.  The content to the left may not be accessible via scrollbar.

How track sizing and content justification handle overspill.  Grid on the left, justify-content on the right.

So if you have a large headline containing a lengthy unhyphenated word, like “Kazakhstan” or “emoluments”, you might prefer one result over the other.

Beyond that, the further possibilities are a lot richer with Grid than with content justification.  Center-justifying the content means exactly that: the element boxes are centered.  So if you were interested in taking the heading and subheading, acting as an apparent unit, and shift them toward one side or another, this would be much easier to accomplish with Grid.

Suppose we want there to be three times as much space to one side of the headings’ column as the other.  Here’s what that would look like:

grid-template-columns:
    minmax(1em,1fr)
    minmax(min-content,max-content)
    minmax(1em,3fr);

That’s it.  One number changed, and the whole setup is offset from the center without losing the coherence of the original demo.

The same thing could likely be approximated with justify-content using side margins on the heading elements, but it wouldn’t be precisely the same, even with percentages.  fr is a very special beast, and permits very unique results.

The other major difference in possibilities is that with Grid, we can rearrange elements visually without ever touching the source.  Suppose we wanted to put the subhead above the heading in some layouts, but not others.  (Whether those different designs live on different pages or at different breakpoints, it really doesn’t matter.)  With Grid, that’s as simple as rewriting the grid template in a line or three of CSS.  The h2 remains ahead of h3 in the HTML.

With justify-content, you’d still have to write that same grid template, or else switch to flexbox and use flex-direction: column-reverse or some such.  That would work if you want to just switch the display order of two headings in a single column.  It tends to fall down for anything more demanding than that.

This is not to say Benjamin came up with a bad alternative!  I like it quite a bit, precisely because it has similar outcomes to my original idea, thus shedding light on creative ways Grid and content alignment can be combined.  But I like it even more for its differences, which shed even more light on how the two things operate.

In that combination of similarity and difference, I can sense an incredible range of capability, chock full of nuance and brimming with possibility.  There are going to be ways to put these things together that nobody has figured out yet.  I know I keep saying this, but there’s a vast landscape opening, so vast that I don’t think we can even guess how far it extends yet, let alone have mapped its terrain.


Gridded Headings

Published 7 years, 6 months past

In my ongoing experiments with both a realignment of meyerweb’s design and CSS Grid, I came up with an interesting heading-and-subheading technique I’d like to share.  It allows two elements to be centered as a block, while letting them text-align with respect to each other, while still line-wrapping if necessary.

Here’s a little demobox.

These Are Grid Headings

A useful technique

Boxes and Alignment

It’s the new hotness

Cool

This is pretty darned easy to implement

Gridded Headings

Wednesday, 19 May 2017

Each heading-subheading pair is composed of two heading elements wrapped in another element.  The wrapping element is the grid container for the headings, each of which become grid items.  This is the markup I used:

<div>
    <h2>These Are Grid Headings</h2>
    <h3>A useful technique</h3>
</div>

If you resize your browser window, or select the “Narrow” option, you should see that the boxes surrounding the headings stays as wide as the wider of the two headings.  It “shrink-wraps” them, visually speaking.  In addition, those boxes stay centered within the grid container.

Furthermore, given the demo’s defaults, the two headings are left-aligned with respect to each other.  You can change this: for example, if you choose to “Center-align headings”, the h2s will center when they’re shorter than the subheadings (the h3s).  On the other hand, if you select “Right-align subheads”, then the subheads will right-align themselves with respect to the headings whenever the subhead is shorter in length.

That was actually a bit misleading: if the headings are centered, they’re centered whether or not they’re shorter than the subhead.  It’s just that, if they’re longer, you can’t see that they’re centered, because left-, center-, and right-aligning them has the same effect.  Ditto for right-aligning the subheads: if they’re longer, they sit in the same place regardless of their text alignment.

The alignments hold even when line-wrapping kicks in.  Try narrowing things down to the point that the text starts wrapping.  If you’re having trouble visualizing the two elements, turn on “Separate backgrounds” to given the heads and subheads visually distinct background colors.

So: a centered box as wide as the longest of the two elements, inside which they can align themselves with respect to each other.  Here’s the CSS that makes this possible:

display: grid;
grid-template-columns:
    minmax(1em,1fr)
    minmax(min-content,max-content)
    minmax(1em,1fr);

That’s pretty much it.  The first and third grid tracks are set to be a minimum of 1em, and a maximum of 1fr.  Given the second track (which I’ll get to in a moment), this means the two tracks will split any free space within the grid container, down to a minimum of 1em.  That’s how the centering of the box work; or, if you turn off “Boxes”, how the unbounded text sticks together in the center of the layout area.

That second track, minmax(min-content,max-content), is what makes all the unusual aspects of this possible.  What that says is: “make this grid track no narrower than the narrowest of the grid items in the track, and no wider than the widest grid item”.  In practice, it’ll most likely be as wide as its widest element.

But if I just said max-content (without having the minmax() and min-content parts) for that track width, the track would always be as wide as the widest element at its widest possible layout, which in this case means without line-wrapping the contents.  That would force particularly long headings to run outside of the track, and possibly out of the grid container altogether.  You can see this by enabling “Remove minmax” and narrowing things until text lines should wrap.

It’s the minmax(min-content,max-content) that avoids this fate, because that means that while the grid track (the column the head and subhead share) can’t get any wider than the widest element it contains, it’s allowed to get narrower.  Thus, if the grid container gets too narrow to fit all the grid items’ maximum widths, the contents of the grid items are able to line-wrap, thus avoiding overspill.  In fact, the grid items can keep getting more narrow until they reach min-content, which is to say, the narrowest the track can get without having content of any grid item stick out of the track.  Then it will stop shrinking.

And finally, if you want to see how the options you’ve selected will look in a Gridless browser, select “Remove grids” and see what happens.  Some combinations may not be palatable without Grid, but remember: you can always use @supports(display: grid) to quarantine any styles that are particularly egregious in older UAs.

So there you have it.  While I’m not certain the Grid drop quotes I wrote about last month will be used in the final version of my styles — I’m still looking to see if they’ll fit with more than 17 years of vaguely ad-hoc markup patterns — it’s pretty close to certain I will use these headings, minus the boxes.  I think they’re a neat effect for blog post titles and dates.

Addendum: As of May 2017, WebKit browsers (e.g. Safari) require vendor prefixes for the min-content and max-content keywords.


Grid Drop Quotes, Revisited

Published 7 years, 7 months past

In last week’s Grid-Powered Drop Quotes, I overlooked a potential problem with the styles I created.  Fortunately, Philippe Wittenbergh caught it and pointed it out, and we both hit on the same solution.

The problem-in-waiting is that the big drop quote will force a gap between the first child element of the blockquote and the second, if the first child is short.  You can see this in the demo below (external version also available), where I made the first paragraph only a few words long.  If you select the “Borders” option, you can see the problem more clearly.

Besides, Grid was coming.

In the run-up to Grid support being released to the public, I was focused on learning and teaching Grid, creating test cases, and using it to build figures for publication.  And then, March 7th, 2017, it shipped to the public in Firefox 52.  I tweeted and posted an article and demo I’d put together the night before, and sat back in wonderment that the day had finally come to pass.  After 20+ years of CSS, finally, a real layout system, a set of properties and values designed from the outset for that purpose.

And then I decided, more or less in that moment, to convert my personal site to use Grid for its main-level layout.  It took me less than five minutes…

The solution is to have the drop quote span multiple rows.  The original CSS went something like this, simplified for the sake of clarity:

blockquote::before {
    grid-column: 1;
    content: "“";
    font-size: 5em;
}

That suffices to drop the drop quote into column 1 (explicitly) and row one (implicitly).  The row is as tall as the tallest of the grid items it contains, so in this case, the quote controls the row height.

The fix:

blockquote::before {
    grid-row: 1 / span 10;
    grid-column: 1;
    content: "“";
    font-size: 5em;
}

You can see that effect by enabling the “Row span” option.  I recommend trying it first with borders turned on, just to see how the element boxes change.

But wait!  Why span 10?  There aren’t that many rows in the blockquote, because there aren’t that many child elements!  That’s okay: the extra rows will be auto-created, but because they contain no content, the rows are of no height.  This means that in cases where there’s a blockquote with a lot of short child elements — think a passage of snappy dialogue — the pseudo-element will have more than enough spannability.  I could’ve gone with span 5 or similar, to echo the font sizing of the drop quote, but no sense risking having too little spannability.  (Which is a word I made up, then discovered it seems to have a meaning in mathematics, so I hope I’m not implying some sort of topological set unity of something.)

Auto-row generation may seem like dark magic, but you’re already soaking in it: remember how none of the blockquote’s child elements are explicitly given a row number, nor did I define rows with the grid-template-rows property?  That means they’re all auto-created rows.  This means if you do something like specify grid-auto-rows: 1em, then all the rows will be one em tall, with the contents spilling out and overlapping with each other.  For extra fun, try setting your auto row height to 0px instead!  (Warning: do not attempt where prohibited by law.)

The other thing Philippe pointed out was that in cases where the blockquote has only a single child element that’s one or two lines tall, the drop quote will not only set the height of the row, but the entire grid.  You can create this situation by selecting the “Short quote” option; again, I recommend leaving “Borders” enabled so you can see what’s happening.

Philippe’s proposal was to bring the line-height of the drop quote to nothing or almost nothing, and add some top margin to make up the difference.  For example:

blockquote::before {
    grid-column: 1;
    content: "“";
    font-size: 5em;
    line-height: 1px;
    margin-top: 0.33em;
}

This certainly works, as you can see by selecting the “Line height” option.  My concern is that having a great big drop quote next to a single-line blockquote is…not optimal.  I’d be more inclined to add a class for short blockquotes, and then restrict the drop quote effect to blockquotes without that class.  For example:

blockquote:not(.short)::before {
    grid-column: 1;
    content: "“";
    font-size: 5em;
}

That removes the need to fiddle with line heights and top margins, in exchange for remembering to class appropriately.  That’s a fair trade as far as I’m concerned.  Your preference may vary, of course.

Many thanks to Philippe for pointing out the error and proposing solutions!


Grid-Powered Drop Quotes

Published 7 years, 7 months past

I’ve been experimenting with CSS Grid for various layout treatments — not high-level, whole-page layouts, but focused bits of design.  I’d like to share one of them for a few reasons.  Partly it’s because I like what I came up with.  More importantly, though, I think it illustrates a few principles and uses of CSS Grid that might not be immediately intuitively obvious.

First, here’s an interactive demo of the thing I’m going to be talking about.  You can use the checkboxes to alter aspects of the example, whether singly or in combination.  Feel free to fiddle with them before reading the rest of the article, or but you’ll probably want to come back to the demonstration as you read.  There’s also an external version of the demo as a standalone file, if you prefer opening it in a new tab and flipping back and forth.

So that’s how things have been laid out since the middle of 2005, more or less. I fiddled with a flexbox layout at one point as an experiment, but never shipped it, because it felt clumsy to be using a one-dimensional layout tool to manage a two-dimensional layout. I probably should have converted the navigation bar to flexbox, but I got distracted by something else and never returned to the effort.

Besides, Grid was coming. In the run-up to Grid support being released to the public, I was focused on learning and teaching Grid, creating test cases, and using it to build figures for publication.  And then, March 7th, 2017, it shipped to the public in Firefox 52.  I tweeted and posted an article and demo I’d put together the night before, and sat back in wonderment that the day had finally come to pass.  After 20+ years of CSS, finally, a real layout system, a set of properties and values designed from the outset for that purpose.

And then I decided, more or less in that moment, to convert my personal site to use Grid for its main-level layout.  It took me less than five minutes…

Let’s dig in!  The core concept here is a Grid-powered version of the big drop-quote on the left side, there, which is a relatively common treatment for blockquotes.  To make this happen, I’ve applied display: grid to the blockquote element itself, and added the opening quote using generated content, like so:

blockquote {
   display: grid;
   grid-template-columns: -webkit-min-content 1fr;
   grid-template-columns: min-content 1fr;
}
blockquote::before {
   grid-column: 1;
   content: "“";
   font-size: 5em;
   font-weight: bold;
}

There’s more to the actual styles of both rules, but that’s the central thesis: set up a two-column grid, and generate a great big opening quote.

The first thing to note here is that generated content also generates a pseudo-element that can be styled.  You may already realize this, since it’s known we can style generated content separately from the main content of the element.  But given that, if a grid is applied to the element, then any generated content’s pseudo-element, whether ::before or ::after, will become a grid item.  You can then place it in the grid.

I first came across this concept in the comments on my ALA article “Practical CSS Grid”, where Šime proposed using generated elements as a hack to get around the inability to directly style grid cells.  Here, I’m just using one to push a quote over to the side.

Why do this, when we can already use floats or relative/absolute positioning approaches to do the same?  Because it’s not quite the same: with Grid, the column containing the drop-quote responds to any changes to the quotation symbol.  Change the font, change its size, have the preferred font fail and fall back to an unexpected face, or replace the character with an SVG image, and the first column will resize thanks to the min-content track sizing, and the actual main content of the blockquote will adjust its placement to accommodate.  That didn’t happen with earlier techniques.

And yes, there is a vendor prefix in there.  Safari’s 10.1 Grid support came with -webkit- prefixed versions of min-content, max-content, and fit-content.  So I did the old pattern of prefixed first, unprefixed second.  This should be necessary only until the next release; Safari has already dropped the prefixes in its latest Technology Preview builds.  The change apparently just didn’t quite make the cut for 10.1.  It’s sad, but it’s also temporary.

In the meantime, this does mean that if you want to restrict your Grid styles only to implementations that don’t require prefixes, use that in your feature queries:

@supports (grid-template-columns: min-content) {…}

That, as well as a number of close variants like using grid-template-rows or max-content, will keep your Grid styles away from Safari until they update their Grid support in the public release channel.

That’s all nice, but there’s a great deal more to learn!  If you use the “Border” checkbox in the demo, you’ll see a dotted red border around the drop quote’s pseudo-element.  Notice that it matches the height of the opening paragraph, not the entire height of the blockquote.  That’s because the pseudo-element and the first paragraph share a row track.  The following paragraphs are in their own row tracks.

This brings up two things to consider.  First, all the child elements of the blockquote are now grid items.  That means the drop quote’s pseudo-element, but also all the paragraphs contained by the blockquote.  The same would happen to any child elements.  We could get around that by wrapping all the contents of the blockquote in a div or something like that, but I’d rather not.  So, this grid has four grid items: the pseudo-element, and three paragraphs.

This leads us to the second consideration: without placing the paragraphs into the same column, they’ll auto-flow into whatever grid cells are available.  You can see this by selecting the “Auto placement” option.  The first column will contain the quote and the second paragraph, as narrow as they both can be due to min-content.  The second column will contain the first and third paragraphs.

How I get around this in the working version is to explicitly put all the paragraphs — really, all child elements of the blockquote, which just happen in the case to be paragraphs — into the second column, like this:

blockquote > * {grid-column: 2;}

Okay, but how do they end up stacked vertically?  After all, I didn’t assign each of those child elements to a row, did I?

Wait a minute.  What rows?

If you go back and look at the CSS I showed, there is nothing about rows.  The property grid-template-rows exists, but I didn’t use it.  All I did was define columns.

Each child element goes into a row of its own anyway, because Grid has the ability to automatically create columns or rows when needed.  Suppose you define a three-by-three grid, and then assign a grid item to the fifth column of the fourth row.  What should happen?  The browser should auto-create as many columns and rows as needed.  Any auto-created tracks will have zero width or height if they don’t contain any grid items, unless you size them using grid-auto-columns or grid-auto-rows, but we’re not going there today.  The point is, here I’ve said all of the blockquote’s child elements should go into column 2.  Given that, they’ll auto-fill rows as available and auto-create rows as needed, filling them in once they’re created.

So the blockquote in the demo above has two columns because I explicitly defined them, and three rows because that’s what it needed to create to handle the three child elements.  If I’d added two more paragraphs and an unordered list, the grid would have had two columns and six rows (because six chid elements).

There are a lot of possible extensions to this technique.  A close quote could be created using ::after and placed in the last row of the grid, thanks to the ability to use negative track values to count back from the end of the grid.  Thus:

blockquote::after {
   grid-column: 3;
   grid-row: -1;
   content: "”";
   font-size: 5em;
   font-weight: bold;   
}

That places the close-quote in the third column, so to the right of the quoted text, and in the last row, regardless of how many rows were auto-created.  Of course, there is no third column…or there wasn’t, until assigning something to the third column.  At the point, the browser created it.

The danger there is that the auto-generated column is essentially tacked on to the trailing edge of the grid, without real consideration for what might be in the way — up to and including the edge of the viewport. Rather than auto-generate the column, we could define a third column like so:

grid-template-columns: min-content 1fr min-content;

This sets up a column on each side of the grid, one for each of the big quotes.  The second column, the one that gets all the actual child elements of the blockquote, receives all the space left over after those outer columns are sized, thanks to its 1fr value.

There’s one more drawback here, albeit one that’s easily overcome.  Grid items’ margins do not collapse.  You can see this effect by checking the “Default margins” option in the demo.  That shows what happens if default paragraph margins are allowed to remain.  We end up with two ems of space between the paragraphs, because each has top and bottom margins of 1em.

In the normal flow, margins collapse to the largest of the adjacent margins, which is why we’re used to 1em of space between adjacent paragraphs.  With grid items, what we see instead is the full element box, margins and all, placed inside the grid cell(s) they occupy.  That means any margin will create space between the edge of the grid cell and the border-edge of the element.  The fix here is straightforward: add a style to reduce margins between elements.  For example, something like:

blockquote > * {
   grid-column: 2;
   margin: 0.5em 0;
}

With a half-em margin above and below each element, any two adjacent elements will have the common 1em separation.  The demo actually has less than that because I wanted to use the print convention of paragraphs with the first lines indented, and a minor separation between paragraphs.  So the actual demo styles are more like this:

blockquote > * {
   grid-column: 2;
   margin: 0.125em 0;
   text-indent: 2.5em;
}
blockquote > *:first-child {
   text-indent: 0;
}

So there you have it: a Grid-powered drop quote.  I should note that all this by itself isn’t quite sufficient: if Grid isn’t supported, it will degrade poorly, as you can verify with the “Disable grid” option.

This is where using @supports() to encapsulate the Grid styling comes in handy.  You can put all of the quote-generation styles into the @supports() block, so that downlevel browsers just don’t get the drop quotes; or, you can set up the drop quotes with floats or positioning and then override those with @supports()-protected Grid styles.  Either one works.

Fortunately, we do have that capability, so it’s fairly easy to progressively enhance your designs with little touches like this one, even if you’re not ready for a full-on Grid plunge.  I’m looking forward to deploying this pattern here on meyerweb, as part of a site design overhaul I’ve been working on for the past couple of weeks.  That’s right: I’m working on my first redesign in a dozen years.  If that doesn’t give you some sense of the power of Grid, well, I just don’t know what will.


There is a followup to this article that explains and corrects an oversight in this article.


Practical CSS Grid

Published 7 years, 8 months past

…In the run-up to Grid support being released to the public, I was focused on learning and teaching Grid, creating test cases, and using it to build figures for publication.  And then, March 7th, 2017, it shipped to the public in Firefox 52.  I tweeted and posted an article and demo I’d put together the night before, and sat back in wonderment that the day had finally come to pass.  After 20+ years of CSS, finally, a real layout system, a set of properties and values designed from the outset for that purpose.

And then I decided, more or less in that moment, to convert my personal site to use Grid for its main-level layout.

Me, writing for A List Apart, taking you on a detailed, illustrated walkthrough of how I added CSS Grid layout to meyerweb.com, while still leaving the old layout in place for non-Grid browsers.  As I write this, Grid is available in the latest public releases of Firefox, Chrome, and Opera, with Safari likely to follow suit within the next few weeks.  Assuming the last holds true, that’s four major browsers shipping major support in the space of one month.  As Jen Simmons hashtagged it, it’s a new day in browser collaboration.

As I’ve said before, I understand being hesitant.  Based on our field’s history, it’s natural to assume that Grid as it stands now is buggy, incomplete, and will have a long ramp-up period before it’s usable.  I am here to tell you, as someone who was there for almost all of that history, Grid is different.  There are areas of incompleteness, but they’re features that haven’t been developed yet, not bugs or omissions.  I’m literally using Grid in production, right now, on this site, and the layout is fine in both Grid browsers and non-Grid browsers (as the article describes).  I’m very likely to add it to our production styles over at An Event Apart in the near future.  I’d probably have done so already, except every second of AEA-related work time I have is consumed by preparations for AEA Seattle (read: tearing my new talk apart and putting it back together with a better structure).

Again, I get being wary.  I do.  We’re used to new CSS stuff taking two years to get up to usefulness.  Not this time.  It’s ready right now.

So: dive in.  Soak up.  Enjoy.  Go forth, and Grid.


Questions and Answers

Published 7 years, 8 months past

“Dad, where is the core of the house?” the youngest asked me this morning, as I made his lunch for school.

I might’ve answered differently if he’d asked me what, but this was specifically where.  Still, I wanted to be sure what he meant, so I asked what he meant by “the core.”  It turned out that, as I thought, he wanted to know the location of the center of the house, like the core of an apple.

I didn’t ask why he wanted to know.  I try not to, in cases like this, although sometimes I say something like, “Why do you ask?  It’s okay that you want to know, I’m just curious about what led to that question.”  But I try to reserve that for questions that seem like they could lead to dangerous activity — e.g., “What would happen if I jumped off a roof?”  (Which, to be clear, I don’t think he’s ever asked, but if he did, I’d answer his question seriously and then ask why he wanted to know.)

This time, I just said, “It’s a good question!  Let’s figure it out.”

First I had him determine which was wider, the living room or the dining room.  He counted off steps and determined the living room was wider.  Then he counted the steps across the front hall (such as it is), and then added up the steps from the three spaces.  They had been big steps, so it was 18 steps across the house.

More steps were taken to measure the house front to back, at which point we figured out that the center was somewhere in the  main stairwell.  (Also the only stairwell.)  But then I threw the curveball: we’d measured the house side to side and front to back.  What else had to be measured?

He thought hard a moment, and then he got it.  The slow-blooming grin on his face was priceless.  Then he laughed.  “How am I supposed to count steps from the basement to the attic?!?  I can’t walk in the air, of course!!”

So we counted the floors and their heights in our heads, and considered that the roof’s peak was a bit higher than the attic ceiling, but that the attic and basement had lower ceilings than the first and second floors.  In the end, we decided the core of the house was probably the step just below the first landing of the stairwell, about two-thirds of the way across it.  He sat in that spot, looking pleased and maybe a little smug.  Then he slid down the stairs, telling me his head felt weird when he thought about how he was sitting in the exact center of the house.

A few minutes later, he’d hauled out the deluxe snap circuit set his uncle had gotten him for Christmas, and was building a circuit of his own making.  Once it was completed, we talked about current flows and why the fan went slower and the light came on when he opened the switch, and the light went off and the fan sped up when it was closed.

And then it was off to kindergarten.  As we walked up the street, he asked why a leaf had moved closer to the door when he slammed it shut instead of being blown further away, so we talked about fluid displacement.  The conversation lasted until he spotted a friend getting out of a car, at which point he ran off to compare outfits.  (Today was Pajama Day at the school.)

I love talking with him about the world and how it works, because it lets me see the world through new eyes.  I felt the same way when I had the same kinds of conversations with his sisters.  It’s a cliché that a small child constantly asking “Why?” is annoying and exasperating, but not to me.  I never, ever want them to stop asking why.  I will always answer their questions, or tell them I don’t know and we’ll find out together.  The internet makes that last part much, much easier than in the past, admittedly.

I have another reason to always give an answer, though.

If I always answer my childrens’ questions, I teach them that questions are okay, that questioning is a good thing.  And more importantly to me, I teach them that they can come to me with anything, and be taken seriously.  Kat feels and acts the same, thankfully.

This has been a real advantage with our eldest, as she moves through middle school and into her teenage years.  She knows she can be honest with us.  More than once, she’s come to us with serious situations in her peer group, and known that we will listen, take her concerns seriously, and will act as needed.  She’s… well, I don’t know if she’s exactly comfortable discussing the biological ramifications of growing up, but she’s able to do so without hesitation or shame.  Because she knows I’ll take her seriously, and listen to her, and not tell her she’s wrong or inappropriate.  A lifetime of answering her questions about ice and airplanes and the Moon and the color of the sky taught her that.

Always listen.  Always give an answer, even if it’s “I don’t know.”  Always take them seriously.

Because one day, that open door may give them a place to go for help and shelter, right when they most need it.


Handiwork

Published 7 years, 8 months past

The story of a mixer-breaking cookbook, the vault of all practical human knowledge, and what I see when I look at my hands

It all started with an afternoon date.  It ended in grease.

Kat and I took a weekend afternoon by ourselves to head down to University Circle, to have some early tea and macarons at Coquette and to see what we might find for a late lunch afterward.  We wandered up and down the new Uptown section, chuckling to ourselves over the massive changes since we’d each come to the city.  See that bowling alley?  Remember when it was a broken parking lot?  And when this bookstore was a strip of gravel and weeds?

In the window of the bookstore, I was looking askance at a coloring-book-for-grownups based on “The Walking Dead” when Kat exclaimed, “Oh, that looks fabulous!”  It was, I was not surprised to discover, a bakers’ cookbook.  Kat loves to bake, mostly for others.  In this case, it was Uri Scheft’s Breaking Breads: A New World of Israeli Baking.

The bookstore was closed, so I took a picture of the cover and we moved on, eventually ending up at a ramen shop.  I had an unagi don.


I gave Kat the book for her birthday.  It’s one of the few things I got right about that celebration this year.

Not long after, Kat had to work at the clinic on a Friday, and asked if I’d make challah from the book so it was ready for dinner that night.  I figured, what the heck.  What could go wrong?  So I hauled out the stand mixer and digital scale, assembled the various ingredients in a line, and started to work.

The challah recipe is sized to make three loaves, because (according to Mr. Scheft) the dough mixes better in large quantities than in small.  I was pleased to see the recipe gave all ingredients first as weights, so I didn’t have to convert.  I’ve never been great at cups and spoons, especially with baking ingredients, and most especially with flour.  I either leave too much air or pack down too hard.  A kilogram of flour seemed like a lot, but once I realized it was only a bit more flour than in the overnight bread recipe I’d made several times before, I forged ahead.

Everything fit fairly well into the mixing bowl, which had been my first concern.  There was enough room to not have the flour overtop the rim and form a glutenclastic flow over the countertop, at least as long as I started slow.  So I did.

Our mixer is a KitchenAid 325W model, bought many years ago and since put to hard service.  Kat as I mentioned before, enjoys baking, being good enough at it that she can often free-style in baking and produce wonderful results.  I do some baking of my own from time to time, though cooking is more my area of strength.  Carolyn has enjoyed learning to bake, and it’s common for her and a friend to decide to make a cake or some cookies when hanging out together, or bake cinnamon rolls for breakfast on a Saturday morning.  One of the last things Rebecca did entirely by herself was hold the dough paddle and slowly, methodically eat raw chocolate-chip cookie dough off of it.  Joshua isn’t as interested in baking yet, but he’s certainly a fan of paddle-cleaning.

As the challah dough started coming together, it kept climbing the dough hook and slowing the mixer, making the motor whine a bit.  I kept shoving it back down, turning the mixer off occasionally to really get it down there.  I was faintly smiling over the possibility that the dough would end overtopping the bowl instead of the raw flour when the hook stopped dead and a buzzing noise burst forth from the motor housing.

Uh-oh.

After I’d removed all the dough from the hook and set the bowl aside — the dough was basically done at that point, thankfully — I tried flipping the gear-speed lever back and forth.  Nothing but buzzing.  It sounded exactly like what you’d expect an unseated gear to sound like, as the teeth buzzed past the gear it was supposed to turn.

There was still bread to make, so I set the mixer aside and got on with the kneading and stretching.  Once the dough started its first rise, I went back to the mixer.  I figured, what the heck, so I banged on the housing a few times to see if the gear would reseat.  And, lo and behold, it started spinning again!  There were still some odd sounds, but it seemed to be mostly okay.  I decided to clean it off, put it away, and see if the “fix” held.


It was a week later that we found the fix had not, in fact, held.  Kat was making babka — from, once again, a recipe in Breaking Breads — for this year’s St. Baldrick’s event in Cleveland Heights when the paddle seized and the buzzing noise once more erupted.

We finished the recipe with a hand mixer (my hand ached for an hour) and I retired to the dining room to search Amazon for a replacement mixer.  We could get the same model for about $300, or a more powerful model for more — although that would mean tossing a bunch of accessories, since the more powerful models use a completely different bowl type.  There wasn’t, so far as I could find, a stronger motor in the same form factor.

On a whim, I opened a new tab and typed “kitchenaid stand mixer stripped gear” into the search bar, and clicked the “Videos” tab.  There were, of course, multiple videos at YouTube, that vast repository of all practical human knowledge.  If you want to know the history of stand mixers, you go to Wikipedia.  If you want to know how to use or fix them, you go to YouTube.

I started watching the first result, realized it was for a different mixer model, and skipped to the “Up Next” video, which was just what I was looking for: same model and everything.  I was a couple of minutes into it when Kat walked into the room saying, “Hey, why don’t you see if maybe you can fix — oh.”


I have not, generally speaking, been what you would call a handy person.  Most of my repair attempts made things worse, not better.  On occasion, I managed to turn a minor inconvenience into a major expense.  I was never particularly ashamed of this, although I was annoyed by the cost.  I wasn’t a stranger to manual labor, but I was always better with a keyboard than I was with a hammer — first 88 keys, and then 104.

But for some reason, one of the first things I did to try to manage my grief, late in 2014, was ask my friend Ferrett to help me do some rough carpentry.  He had the tools, having taken woodworking classes in the past, and I wanted to put a bookcase in the wall of our finished attic.  From that first painful attempt — it took us all day to put together a not-particularly-well-made case — we started getting together once a week or so to just build stuff.  Our friend Jim got into the act as well.

A bookcase here, a shelf there, we’ve gotten better at it.  We’ve managed to use every tool in the arsenal, though not always wisely.  We’ve made abstruse jokes based on the biscuit cutter being made by Freud.  We’ve invented hacks on the spot to make cuts easier and figured out later why things didn’t go quite as intended.  We’ve learned that you can never be too rich or have too many clamps.  (We depart from standard societal attitudes toward thinness.)

As we’ve progressed, those attitudes and skills have osmosed into regular life.  Minor home repair is now a thing I do, and approach with confidence instead of trepidation.  No real surprise there: practice at anything, and you’re likely to become better at it.  But when the screen door latch broke, I bought a replacement and improvised a way to make it work when the frame bracket and latch didn’t line up.  I took a Dremel to my aging laptop stand in order to keep it from scratching desks.  I’ve fixed more than one damaged or jammed toy.

So, sure, why not see if the mixer could be fixed with a cheap part replacement?  After all, a handyman told me years ago, if it’s already broken, trying to fix it can’t make it any worse.  Though I remember thinking to myself that he’d never seen me try to fix things.

I assembled my tools, covered the dining room table in several layers of drop cloth, and started the video.  I had real trouble getting out the roll pin that held the planetary in place, but WD-40 and persistence won the day.  I had to stop for a while while I searched for surgical gloves, but eventually they turned up and I got into the great globs of grease that keep the gears going.  And yes, just as the video had prophesied, the problem was the one plastic gear in the mechanism, nestled in amongst the chain of solid metal gears.

I’m not annoyed by this.  That gear, I believe, is intentionally plastic as a last-ditch defense against burning out the motor or shattering a metal gear or the paddle itself, should somethiing seize up the planetary.  Think of a metal bar that somehow gets thrust into the paddle, forcing it to stop.  Something has to give.  A small worm gear acting as a fail-safe is a better option than most others.

I went back to Amazon, this time to order a replacement part.  When I found out they were $6.24 each, I ordered three.  Until the new worm gears arrive, the various screws and pins I removed are taped in groups to a piece of printer paper, each group labeled according to their points of origin in the mixer assembly.  The gear tower pieces I put in a plastic sandwich bag, also taped to the paper, to keep their grease contained.

The broken worm gear I may throw away, or I may keep as a memento.


I am, in my way, pleased with myself about all this.  Proud both that I may be able to fix a problem for $7 and an hour or two of time, instead of having to replace an entire appliance for a few hundred dollars; and also for having developed the skills and familiarity to let me try it in the first place.  True, I likely couldn’t have done it without YouTube, but in years past, even with YouTube I’d have been hesitant to try, for fear of making it worse, or just being hapless and frustrated by the feeling that if I only knew more, I’d be able to do it right.

Now I know more.  I’ve learned — not at internet speed, but at slow, methodical, human speed.  I’ve changed, but in ways of my own making instead of ways that circumstance thrust upon me.

When I look at my hands now, I see tools that not only create, but can also repair.  They can put to right at least some things that have gone wrong.

There is much more solace in that than I would ever have guessed.

I don’t know, as I write this, whether the mixer will work again.  I may reassemble it incorrectly, or even correctly but without success.  Sometimes that happens.  Sometimes you do everything right, and still have no path to success.  But if we do have to junk it after all, I’ll know it wasn’t for lack of first trying to correct the situation.

I will draw pride from that, just as I did from the challah I made for my family and friends, an entire loaf of which was quickly devoured.  Just as I have drawn pride from things I’ve written, shaping words that have helped others in ways large and small, and sometimes in ways completely unexpected.

The difference is that when I fix things, I fix for myself, not for others.  One small repair at a time, I fix myself.


Getting Grid

Published 7 years, 8 months past

That converting-meyerweb-to-Grid article I’ve mentioned previously is still coming along (3,999 words as of the last draft, and I realized last night it needs another few hundred) and I think it will be out within a week.  I’ll do my best!  In the meantime, I’d like to point you to a few resources from the end of the article, plus do a tiny bit of self-promotion.

Resources first!  If you’re wondering what Grid means for Flexbox, Chen Hui Jing has a lovely piece on “Grid + Flexbox: the best 1-2 punch in web layout”.  Just the right length, with live Codepens, this is a very good introduction to using Grid and Flexbox in harmony.  Some of what’s described there won’t be as necessary in the future, as Flexbox-style alignment migrates to Grid, but in the meantime Hui Jing explores the current state of the art with elegance.

If you have Firefox or Chrome and they’re updated to the latest release (FF52, C57) then I strongly encourage you to set aside a few minutes and go browse The Experimental Layout Lab of Jen Simmons.  Jen’s been creating Grid demonstrations and experiments for well over a year now, and there are some really great examples there, summarizing some common design patterns and showing how Grid can make them much simpler and more robust.  I especially recommend the 2016 home page, which combines CSS Grid, writing modes, transforms, and design history to create something really great (try resizing to see the responsive coolness).  But don’t stop there!

If you like your learning in motion, Rachel Andrew’s video series introducing Grid concepts and properties is fabulous.  As an application developer — she’s part of the Perch CMS team — she’s been excited about Grid and what it can do longer than just about anyone.  Her deep technical skills and teaching abilities really come together in the video series.  If you prefer to read up on Grid, then Rachel’s written a series of articles for the Mozilla Developer Network that cover similar ground.

Finally, if you like extended technical explanations of every Grid property and value seasoned with lots of examples and screenshots, then I suggest picking up the Early Access version of CSS: The Definitive Guide, 4th EditionEstelle Weyl and I have been working on finishing this for a while now, and it’s just about ready: there are three chapters still to be added.  They’ve already been written, but haven’t quite finished first editorial review and production massaging.  But: the Grid chapter is already available, so if you get the book now, you’ll have instant access to something like 25,000 words going through Grid property by property.  And also a whooooole lot more words covering everything else in CSS.  (The current page count estimate for the book is 950.  Nine hundred fifty.  Yoinks.)

Go forth and Grid!


Browse the Archive

Earlier Entries

Later Entries