CSS Foldable Display Polyfill

CSS Foldable Display Polyfill

At 3/31/2024

Foldable phones are starting to be a thing. Early days, for sure, but some are already shipping, and they definitely have web browsers on them. Stands to reason that, as web designers, we are going to want to know where that fold is so we can design screens that fit onto the top half and bottom half… or left half and right half¹.

Looks like that’s going to make its way to us in the form of env() constants, just like all that notch stuff.

The code block in the polyfill repo is:

@media (spanning: single-fold-vertical) {
  body {
    flex-direction: row;
  }
  .map {
    flex: 1 1 env(fold-left)
  }
  .locations-list {
    flex: 1;
  }
}

I would also think it could be…

@media (spanning: single-fold-vertical) {
  .page-wrap {
    display: grid;
    grid-template-columns: env(fold-left) 1fr;
  }
}

Interesting how there is no fold-right, isn’t it? And aren’t we trying to stay away from directional terms like that and use logical properties? Why not fold-inline-start?

  1. It’ll be interesting to see how that sentence ages. Just watch the first really popular foldable phone will have three segments.
حقوق التأليف والنشر

نحن نحترم حقوق الملكية للآخرين ونحرص دائمًا على عدم التعدي على حقوقهم، لذا يحق للمؤلفين ودور النشر المطالبة بإزالة رابط تحميل مقال أو كتاب من الموقع. إذا وجدت مقالاً أو كتاباً خاصاً بك ولم توافق على نشر رابط التحميل أو كان لديك اقتراح أو شكوى راسلنا عبر تواصل معنا, أو عن طريق البريد الإلكتروني في: support@freewsad.com.

المزيد عنا