W3C home > Mailing lists > Public > www-style@w3.org > January 2016

Re: [css-sizing] default object size for intrinsic sizes of replaced elements

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 26 Jan 2016 11:48:58 -0800
Message-ID: <CAAWBYDCnbAkK09kerAzQ_F_F2fK-YG5vuREJw2d2Q-G82CZ7Kg@mail.gmail.com>
To: David Vest <davve@opera.com>
Cc: www-style list <www-style@w3.org>
On Tue, Jan 26, 2016 at 1:39 AM, David Vest <davve@opera.com> wrote:
> https://drafts.csswg.org/css-sizing-3/#replaced-intrinsic says:
>   For replaced elements, the min-content size and max-content size are
>   equivalent and correspond to the appropriate dimension of the
>   concrete object size returned by the default sizing algorithm
>   [CSS3-IMAGES] of the element, calculated with an unconstrained
>   specified size.
> It doesn't say what's the default object size should be in this
> case. If it would be the standard 300x150 fallback I fear the svg
> would pop out to 300px in something like:
> <!DOCTYPE html>
> <style>
>     div { width: 100px }
> </style>
> <div><svg viewBox="0 0 1 1"></svg></div>
> Other options?

Inline SVG counts as a replaced element for the layout algorithm;
<https://drafts.csswg.org/css-images/#object-sizing-examples> says
that the sizing of replaced elements are defined in 2.1. In
particular, this is defined in
(section 10.3.2, the first link in the replaced elements example in
Images).  This case is technically undefined (browsers were
inconsistent at the time we were finalizing 2.1), but the suggestion
is that replaced elements with an aspect ratio "act like blocks" (more
or less) to determine their width, and the height is calculated from
that and the aspect ratio.

(If it didn't have a viewBox to give it an aspect ratio, it would
indeed default to 300x150, as defined in the places I talk about

Received on Tuesday, 26 January 2016 19:49:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:00 UTC