The aspect-ratio CSS property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and some other layout functions.
對於圖片來說,這可以用來指定希望 crop 多少的範圍。
作者也有提到以往的 hack 方式是透過 padding 與 calc + var 的方式達到,現在讓瀏覽器直接處理就簡單不少了,這張示意圖就蠻清楚表達想要做的事情是怎麼樣:
The following css/selectors web tests are failing on below platform:
css/selectors/has-basic.html - Failing on chrome/edge/firefox/safari/webkit
css/selectors/parsing/parse-has.html - Failing on chrome/edge/firefox/safari/webkit
Supports all ':has' relative argument cases
Currently the relative selector is not supported yet, so this CL
provides the relative argument cases as follows.
- :has(:scope > <complex-selector>)
- :has(:scope ~ <complex-selector>)
- :has(:scope + <complex-selector>)
So this CL only supports :has argument selectors starting with
descendant combinator. Argument selectors starting with other
combinators are not supported yet.
- .a:has(.b) : Supported
- .a:has(> .b) : Not supported yet
- .a:has(~ .b) : Not supported yet
- .a:has(+ .b) : Not supported yet