This is my daughter Rebecca in 2013. She was 5¼ years old when I took this picture. Less than three days later, she almost died on an ER bed.
She’d been completely fine when we set out for vacation that year, and just seemed to come down with a virus or something just after we arrived. She got checked out at an urgent care center, where they diagnosed strep throat. But antibiotics didn’t help. She slowly got more and more sick. We finally took her to be checked out at a nearby hospital, who were just as stumped as we were. They were looking for a room to put her in when she seized and flatlined.
Just like that. She’d been ill, but not severely so. All of sudden, she was on the edge of death. The ER staff barely stabilized her, by intubating her and administering drugs to induce a coma.
There was a large tumor in the center of her brain. Our five-year-old girl, who so far as we knew was completely fine just days before, had aggressive brain cancer.
After a midnight life flight nobody was sure she would survive, she arrived in Philadelphia and had several cranial surgeries, spent more than a week in the pediatric intensive care unit, and then was transferred down a few levels to spend another two weeks on the recovery floor, slowly rebuilding the muscle strength she’d lost from more than a week of immobility.
Later, there were weeks on weeks of radiation and chemotherapy in Philadelphia. After the initial treatment was done, we came home to Cleveland for more chemotherapy.
This is her, hauling her baby brother Joshua up the slide in our backyard, and hauling her mom through the crowd at the local garlic festival. At a CureSearch walk with her siblings and dozens of friends and family. Just barely tolerating my terrible dad jokes, doing her utmost not to encourage me by laughing.
We did everything we could, sometimes through tears and sickening horror, but the treatments didn’t work. Rebecca died at home, surrounded by friends and family one final time, less than ten months after her cancer was discovered, in the early evening hours of June 7th, 2014, her sixth birthday.
In those ten months, the total retail cost of her procedures and treatments was $1,691,627.45. Nearly one point seven million US dollars.
We had health insurance—really good insurance, thanks to COSE’s group plans and my wife’s and my combined incomes. The insurance company’s negotiated rates meant they paid $991,537.29, or about 58% of the retail price.
We paid very little, comparatively speaking, until you counted the monthly premiums. All of it together, co-pays and premiums, was still in the low five figures. Which we were, fortunately, able to pay.
Without insurance, even if we’d been able to get the insurer’s rate, we’d have gone bankrupt. All our investments, our house, everything gone. If pre-existing conditions had prevented us from being covered, or if we’d been less fortunate and unable to afford premiums—bankrupted.
In which case, Rebecca’s brother and sister would have suffered her death, and the loss of their home and what precious little remained normal in their lives.
How many families live through that double hell? How many go completely broke trying to save their child? How many could have saved their children, with coverage that paid for life-saving treatments? How many never had any chance of saving their child, but ran out of money before treatment was complete and now believe their lack of insurance and money was what killed their child?
How many more will have to live with those unthinkable situations, if the House and Senate bills go forward?
The point, the essential point, is this: every family should have the chance to fight as hard as possible for their loved one’s life without going bankrupt in the process. And for those who cannot be saved, no family should be denied the knowledge that they didn’t have a chance. Because knowing that does provide some (small) measure of comfort.
The Affordable Care Act wasn’t perfect, and it was severely and willfully undercut after it launched, but it was a huge step in the right direction. The bill currently before Congress would be an enormous step back. I doubt that I’ll benefit from the tax cuts that are part of the bill, but if I do, I’ll commit every cent I get from them and more to unseat anyone who votes yes on this bill. I have let my senators know this.
I would spare every family the pain we endured, if I could, but nobody has that power. We do, together, have the power to help every family that must endure that pain, to give them access to the simple safety net they need, to concentrate everything they can on the struggle to heal.
I miss her every day, but I know that we did everything that could be done, including being able to afford the hospice care that kept her as comfortable as possible in her final hours, preventing the seizures and pain and fear that would have made her last moments a hell beyond endurance. Allowing her a peaceful end. Every family should have access to that.
Please think about what it means to take that ability away. Please think about what it means to take away the ability to avoid having to make those choices.
Three years ago, almost exactly to the minute as I publish this, I delivered the eulogy at my daughter’s funeral. A few months after that, reading it again, I discovered that when I wrote it, I didn’t really finish it. I understand why: I wrote it in the days after her death, and was not really able to think it through. It was only in hindsight that I realized what was missing.
So today, I’m publishing the eulogy as I would have written it, had I been of clearer mind. The final two sentences below are what I left off.
Rebecca was fierce. She beat adults in staring contests when she was two weeks old. Rebecca was joyful. Her laugh could fill a room and bring a smile to anyone who heard it. Rebecca was stubborn. She would often refuse to give in, even when it cost her something she wanted. Rebecca was kind, and loving, and mischievous, and oh so very ticklish.
She vibrated with energy. Her philosophy was essentially: never walk when you can skip, never skip when you can run, never run when you can dance, and never dance when you can hide yourself around the next corner and then laughingly yell “BOO!” when everyone else finally catches up with you.
She loved to steal our phones and wallets and keys from our pockets, not to hide them away or do anything mean or malicious, but to wave them in front of us and laugh her way through an affectionate, singsong tease. If there’s a world beyond this one, I hope whoever’s in charge has secured all the valuables. Not to prevent her from swiping them, which would be an impossible goal, but because she would be disappointed and bored if they were too easy to swipe.
Rebecca is not an angel, nor would she wish to be. If anything, Rebecca is now a poltergeist. On her sixth birthday, we had planned to go to Cedar Point that day and the next. Instead, that was the day she died… and on that day, a water main break closed Cedar Point for the entire weekend, because if she couldn’t go, then nobody gets to go. And in brief conversation this morning, I was literally about to say the words “lose electricity” when the power went out in our house.
The little stinker.
One of the hardest things for us in the last few weeks of her life was seeing how the tumor slowly and inexorably took all that sass and spice away from her. The loss of energy and emotion was horrible. We had fought so long and hard to keep her quality of life normal, and we had succeeded. It was only at the very end, just the last few days, that she moved beyond our ability to preserve it.
Underneath it all, she was still Rebecca. She got mad at her sister and brother because they would get to stay us and she wouldn’t, and then she forgave them because she understood it wasn’t their fault and she loved them so much. She gave us disdainful looks when she thought our attempts to tease her were lame. She asked, wordlessly but clearly, to hear her favorite stories. She told us she didn’t love us because she wanted to push us away, to lessen our pain. But when we explained to her that the joy of loving her was worth any pain, and that we could never stop loving her regardless, she relented and admitted the truth that we had never doubted. The last words and gestures that passed between us were of love.
In her last hours, she was surrounded by love, her room filled with people who loved her as she loved them, never leaving her alone for a second. We held and snuggled her all the way to the end, all of us together. And the people in that room were surrounded by the love of those who loved them, and they by those who loved them. All of that love focused on Rebecca. She deserved it. But then, so does every child.
Now she is gone, and we who remain are devastated. It is only together that we will move forward. Community has sustained us the past months, and made it possible for us to do everything we could for Rebecca and Carolyn and Joshua. Community will help us get through this. Our hearts have been broken into uncountable pieces, but we will help pick up those pieces together. I am beyond heartbroken that she is gone, but I will never, not for an instant, ever regret that she came into our home and our lives.
What matters in this life is not what we do but what we do for others, the legacy we leave and the imprint we make. Her time may have been short, but her spark illuminated so much in that time, touched and warmed so many people, and for the rest of our days we will all be changed for the better.
She’s been gone for half her life. Half the time she had with us, elapsed in absence.
It’s still hard to comprehend. The old adage that you don’t get over it, but you get used to it, holds true. I’m used to her absence. I still think of her daily, usually multiple times a day, reminded one way or another. The reminders can spring from moments of joy that I suddenly realize she isn’t there to share, or from moments of profound sorrow over the state of everything, or just from spotting an unexpected flash of purple.
In the initial grieving, each moment of remembrance was like an enormous jagged spike driven violently through my chest, impaling me in an anguish I could not actually feel, even as I experienced it. My breath would hitch to a stop as I remembered the hitch in hers, as her body finally relaxed and the space between each breath got longer and longer, even as each breath was a fractional bit fainter than the one before.
My grief has similarly faded, these last three years. That terrible, transfixing pain has its own slope of decay, if you let it decay, dropping into a long tail of quiescence. If you’ve ever suffered a major injury, then you know what I mean. The initial pain is overwhelming, filling your entire awareness and leaving room for nothing else. That fades into a massive suffering as the injury is addressed. After the initial recovery, you come to live with a constant pain that is manageable, if utterly draining to endure. After a longer while, that becomes an ongoing ache, easily aggravated but also somewhat possible to ignore for short periods. And so on and so on, until months or years later, it’s a twinge you get every now and then, maybe a dull ache when the weather changes or you shift your weight the wrong way. Something you can live with, but also something you can never fully forget.
I can still sometimes feel the spikes that were driven into me, but distantly, around the edges where the scar tissue grew to fill the latticework of grief. As you might feel the shadows of the pins that put your leg back together, or the echo of the holes drilled into your skull to seat the halo brace.
We went to visit her grave this afternoon. It was our first time back since last year’s memorial visit. I’d thought of going from time to time in the intervening year, and resisted. I’m not entirely certain why, but it felt like the right decision. Not the decision I wanted to make, but the right one.
We were astonished to find that the artificial flowers and rainbow spinner placed there last year were still in place, faded and worn. The groundskeepers had carefully mowed around them. Perhaps that’s why the small Rainbow Dash toy was still there, still nestled against the top edge of the marker. It, too, was faded from the year of sun and rain and ice, but still had the same jaunty pose and smiling face.
It reminded me of Rebecca, and I smiled a little.
I noticed dirt had settled into some of the letters, and resolved to return another day to clean them out. Maybe polish the granite face a bit, to see if I could restore some of its initial luster. Nothing I could do would preserve that forever; the slow decay of time and weather never pauses, not even in deference to the memory of a little girl who lived too short a life, no matter how fully she lived it.
In the long run, the marker will be worn smooth, settling through a long period of becoming harder and harder to read until eventually, it fades completely from understanding. That can’t be avoided, but it can be postponed a little bit. As long as I’m here and able, I can put in a little periodic effort to undo some of the damage done. Put things partly right. It might seem futile, but sometimes small acts in the face of futility is the best you can do.
…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.
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.
“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.
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.
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.
It has been one thousand days since our daughter took her last breath.
I don’t know if it’s a cruel irony or a fortunate happenstance that this coincides with an upward adjustment in my antidepression medication. It was necessary, because I was losing the will to do anything but the bare necessary minimum to function. Now I can actually initiate conversation, and see life as something other than a state to be passively endured. But the surge in serotonin reuptake inhibitors has also distanced me from grief.
I can feel, distantly, the despair that accompanies this milestone and its root cause. I can feel, distantly, the instinct that I should bring that despair closer, to mourn a little more and honor Rebecca’s memory. It stays on the horizon of my awareness, something to be noticed when my gaze happens to turn that direction. Not more.
I can feel, distantly, the conviction that this is abnormal and should be unacceptable. Maybe that’s true. Maybe it isn’t.
I still miss her. I still, from time to time, wonder how I managed to get this far in the wake of so shattering a loss. I honestly didn’t think I’d have the strength. Maybe I was born with it. Maybe it’s paroxetine.
I don’t know how I’ll feel toward the end of the month, when I reach 210 days, and I guess in some ways it doesn’t matter. The day will come, the day will go, and it will be whatever it is.
I’ve been working a lot with the clip-path property recently, as I write the chapter on filters, blends, clipping, and masking for CSS: The Definitive Guide’s long-delayed 4th edition (available now in early-release format!). One of the nifty things you can do with clipping paths is define them with percentage-based coordinates. For example, here’s a hexagon-like clipping path:
I didn’t want pixels, though. I want percentages, darn it all!
So I asked around on Twitter, and Markus Stange pointed me to the solution: converting all the SVG coordinates to the range 0–1 and using the clipPathUnits attribute. The working version looks like this:
That yields the same result as the polygon() CSS shape with the percentages I showed before.
All that is great if you’re writing your own SVG shapes and can make sure you set it up properly, but what if someone hands you a shape to be used as a clip path and it’s in absolute coordinates like 100 75? If you’re really lucky, the shape has a viewbox of 0 0 100 100 (or all the coordinate points are in that range) and you can just divide all the coordinate points by 100 to get the proper values. But that’s really tedious for any but the simplest of shapes, and besides, what if it has some other viewbox? That’s where the transform attribute saves the day.
For example, suppose you get an SVG file that looks like this (with the actual path coordinates removed because there are a lot of them):
Next, look at the viewBox attribute on the <svg> element itself. The value there is 329.6667 86. That means 329.6667 coordinate units horizontally, and 86 units vertically. So all you need to do now is divide all the horizontal values by 329.6667, and the vertical values by 86. Which would be super tedious, except we have scaling transforms at our disposal:
Those two values are 1/329.6667 and 1/86, respectively, and they effectively scale every point in the d attribute to fit into the needed 0–1 range. (That’s not precisely what happens, but the outcome is the same.) Thus we have an SVG clipping path that scales with the element and fits to its dimensions!
This works just as well for other markup patterns. To return to the hexlike path from before, assume it was written like this:
If that were applied as-is, via clip-path: url(#hexlike), it would create a hex-like clipping path that fits a 100px by 100px box, positioned in the top left of the element (in left-to-right languages, I presume). The quick fix:
Bingo bango bongo, it will now scale to the element’s dimensions, whatever those turn out to be.
Of course, if you apply that to something like a short paragraph, it will be verrrrry stretched out, but the same would be true with a percentage-based polygon() shape. The beauty here is that you can scale any coordinate set, so if you have a tiny path that you want to blow up, or a huge path you want to shrink down, you can transform it without using clipPathUnits to stretch it over the bounding box. Something like this:
That gets you a hexlike shape that fits a 400px by 400px box, for example.
Now all CSS needs is the ability to size and position clipping paths in a manner similar background images, and we’ll be in clover. I hope such properties are in the WG’s mind, because I’d love to be able to just point an at SVG clipping path, and then say something like clip-path-position: center; clip-path-size: contain;. That would remove the need for fiddling with SVG attributes altogether.
Thanks to Markus Stange for the technique and his invaluable assistance in proofreading this article.