3
I don’t know how this property works or how to use it because I’ve tried to research more about it and only found two sites that mentions a little bit about it:
But in practice visually not change anything I’ve tried the same codes CSS of the two sites, but it’s the same thing to have no effect:
<style>
.box {
width: 400px;
height: auto;
background: red;
aspect-ratio: 1/1; /* ou 16/9 */
}
</style>
<div class="box"></div>
My questions are:
How it works and how to use this property?
It is supported in all browsers?
Because there is a property that cannot be used?
– Gabriel Oliveira
@Gabrieloliveira pq she is not yet official, and depending on the status she is in the Draft may still simply never see the light of day and never be made official... Here you can better understand how CSS properties are "created" and made official or not by W3C https://answall.com/questions/354803/quais-s%C3%a3o-as-phased-standardized%C3%A7%C3%a3o-de-a-property-css/355543#355543
– hugocsl
@Gabrieloliveira is not the W3 that implements in the browsers, they only say the "standards" and formats that should use and the effect that should produce, the responsibility of making this in part of the browser is of each browser developers specific, Firefox is one Chrome is another, the firefox engine is one, Chrome is another, the same goes for Edge and Safari, the responsibility to apply described features and make them reality is of the "companies" or open-source organizations, the W3 is just who "dictates". So there’s no way a property exists at the same time it’s idealized.
– Guilherme Nascimento
Gabriel, of course the browser might even implement something that is not part of the standards/standards, but this is called non-standard (non-standard), so it probably won’t exist in 2 different browsers, has many examples of features that are only from Firefox and others just from Chrome, are sometimes useful, but there is no way to depend on them for something cross-browser. PS: Hugo +1 for reporting that this is still a draft/idea and that it has not actually been "approved".
– Guilherme Nascimento
@Guilhermenascimento well observed even, really the deployment in the end goes from the team that develops the browser. A pretty crazy example is the
-webkit-text-stroke
which is a relatively old property, which is unofficial, and which to work on any browser, Safari, Chrome, Firefox and even the old Edge needs to use the see prefix-webkit-
https://caniuse.com/#feat=text-Stroke While other things already deprecated by the W3C itself still work on modern browsers :D– hugocsl
Note that if this leaves the draft (draft/idea) and becomes a standard and is supported by a browser, I recommend that you edit the response but keep the information that exists today as history, if possible with dates in the titles to explain the motivations of that having been written in such "time" and so help to notice the evolution of this CSS property. Imagine that the property exists in the future, but has changed something, it would be interesting to pass it on. But of course for me at least I like to know the story behind the technologies
– Guilherme Nascimento
@Guilhermenascimento for sure, editions with dates and keeping the history is always cool, at least in my view... Sometimes I come back in response and update information when necessary, but if it is up to W3C to drop some update we can wait seated.....
– hugocsl
Thank you! To all of you by force, you have clerified my mind now :)
– joão batista