Supporting logical properties

I wrote recently about making the switch to logical properties over on The Session.

Initially I tried ripping the band-aid off and swapping out all the directional properties for logical properties. After all, support for logical properties is green across the board.

But then I got some reports of people seeing formating issues. These people were using Safari on devices that could no longer update their operating system. Because versions of Safari are tied to versions of the operating system, there was nothing they could do other than switch to using a different browser.

I’ve said it before and I’ll say it again, but as long as this situation continues, Safari is not an evergreen browser. (I also understand that problem lies with the OS architecture—it must be incredibly frustrating for the folks working on WebKit and/or Safari.)

So I needed to add fallbacks for older browsers that don’t support logical properties. Or, to put it another way, I needed to add logical properties as a progressive enhancement.

“No problem!” I thought. “The way that CSS works, I can just put the logical version right after the directional version.”

element {
  margin-left: 1em;
  margin-inline-start: 1em;

But that’s not true in this case. I’m not over-riding a value, I’m setting two different properties.

In a left-to-right language like English it’s true that margin-inline-start will over-ride margin-left. But in a right-to-left language, I’ve just set margin-left and margin-inline-start (which happens to be on the right).

This is a job for @supports!

element {
  margin-left: 1em;
@supports (margin-inline-start: 1em) {
  element {
    margin-left: unset;
    margin-inline-start: 1em;

I’m doing two things inside the @supports block. I’m applying the logical property I’ve just tested for. I’m also undoing the previously declared directional property.

A value of unset is perfect for this:

The unset CSS keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. In other words, it behaves like the inherit keyword in the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property.

Now I’ve got three CSS features working very nicely together:

  1. @supports (also known as feature queries),
  2. logical properties, and
  3. the unset keyword.

For anyone using an up-to-date browser, none of this will make any difference. But for anyone who can’t update their Safari browser because they can’t update their operating system, because they don’t want to throw out their perfectly functional Apple device, they’ll continue to get the older directional properties:

I discovered that my Mom’s iPad was a 1st generation iPad Air. Apple stopped supporting that device in iOS 12, which means it was stuck with whatever version of Safari last shipped with iOS 12.

Have you published a response to this? :


Chris Coyier

margin-left doesn’t override margin-inline-start, they are 2 different properties. If you can’t go all-in yet (because, say, old Safari), you have to use @​supports to check support, unset the non-logical property, then set the logical property.

Gerasimos Tsiamalos

“Because versions of Safari are tied to versions of the operating system, there was nothing they could do other than switch to using a different browser.” It is the new IE and we’ll have to deal with this bs for years to come.

1 Like

# Liked by Marty McGuire on Friday, September 30th, 2022 at 3:42pm

Previously on this day

1 year ago I wrote Twenty years of writing on my website

This online journal is two decades old.

6 years ago I wrote Someday

Changing defaults in browsers …someday.

11 years ago I wrote Ten

Happy birthday to this.

13 years ago I wrote Culchavulching

In Brighton, no-one can hear you geek out.

13 years ago I wrote Full Frontal

Be in Brighton on November 20th.

14 years ago I wrote Reading immaterial

Something for your digital bookshelf.

14 years ago I wrote Automata

Carla Diana talks about robots at Flash on the Beach in Brighton.

15 years ago I wrote Kung Shui

Ajax and accessibility; a presentation transcribed.

16 years ago I wrote Sydney to Melbourne

It’s time for me to expand my Australian horizons.

16 years ago I wrote Wrapping up Web Directions South

Two thumbs up from me.

17 years ago I wrote He comes from a land down under

The podcasts and the photos have started coming in from Web Essentials in Syndey. Oh, how I wish I could be there!

19 years ago I wrote WiFi Regained

Remember how I was saying that the wireless reception in my iBook went all screwy a while back? Well, I sent the iBook off to Apple so that they could have a look at it.

20 years ago I wrote Anniversary

I have been blogging now for exactly one year.

20 years ago I wrote dooce

Rejoice! For Heather Hamilton is back.

20 years ago I wrote JCPenney

Jessica refuses to believe that JCPenney are actually selling the "Forward Command Post" model in their catalogue:

21 years ago I wrote Welcome to my world

This is my first entry in my first online journal.