Re: Fall back to a different property:value pair if another property:value pair is not supported.

On Tuesday 2018-12-11 17:35 +0000, Philip Taylor wrote:
> Browser support for "width: fit-content" is good but not universal (albeit requiring vendor prefixes in some cases) and for those cases where support is completely lacking one can fall back to "display: table".  However, I do not wish to abuse the "display" property in this way if it is unnecessary so to do.  Is there any standards-compliant way of falling back on "display: table" IFF "width: <possible vendor prefix>fit-content" is unsupported (as in the case of, e.g., Internet Explorer) ?

Yes.  See https://drafts.csswg.org/css-conditional/#at-supports and
https://developer.mozilla.org/en-US/docs/Web/CSS/@supports .

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Tuesday, 11 December 2018 21:23:07 UTC