<ratio>

  • Revision slug: CSS/ratio
  • Revision title: ratio
  • Revision id: 70166
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 20 words added

Revision Content

Summary

The <ratio> CSS data types, used in media queries, denotes the proportion between two unitless values. It is a strictly positive {{ xref_cssinteger() }} followed by a slash ('/', Unicode U+002F SOLIDUS) and a second strictly positive {{ xref_cssinteger() }}. There may be spaces before and after the solidus.

Examples

A few common device ratios
Ratio4_3.png 4/3 or 8/6 Traditional TV format in the 20th century
     
@media screen and (device-aspect-ratio: 16/9) { … }

Specifications

Specification Status Comment

CSS Media Queries Level 3

{{ Spec2('CSS3 Media Queries') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support <4 3.5 (1.9.1) 9 9.5 1.0 (?)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support yes yes ? yes yes

See also

{{ languages( { "ja": "ja/CSS/resolution" } ) }}

Revision Source

<h2>Summary</h2>
<p>The <code>&lt;ratio&gt; </code><a href="/en/CSS" title="CSS">CSS</a> data types, used in <a class="internal" href="/En/CSS/Media_queries" title="en/CSS/Media queries">media queries</a>, denotes the proportion between two unitless values. It is a strictly positive {{ xref_cssinteger() }} followed by a slash ('/', Unicode<code> U+002F SOLIDUS</code>) and a second strictly positive {{ xref_cssinteger() }}. There may be spaces before and after the solidus.</p><h2 name="Examples">Examples</h2>
<table border="0"> <caption>A few common device ratios</caption> <tbody> <tr> <td><img alt="Ratio4_3.png" class="internal default" src="/@api/deki/files/5709/=Ratio4_3.png"></td> <td><code>4/3</code> or <code>8/6</code></td> <td>Traditional TV format in the 20<sup>th</sup> century</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </tbody>
</table>
<pre><code>@media screen and (device-aspect-ratio: 16/9) { … }</code>
</pre>
<h2 name="Specifications">Specifications</h2>
<table class="standard-table"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td> <p><a class="external" href="http://www.w3.org/TR/css3-mediaqueries/#values" title="http://www.w3.org/TR/css3-mediaqueries/#values">CSS Media Queries Level 3</a></p> </td> <td>{{ Spec2('CSS3 Media Queries') }}</td> <td> </td> </tr> </tbody>
</table>
<h2>Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>&lt;4</td> <td>3.5 (1.9.1)</td> <td>9 <a class="external" href="http://blogs.msdn.com/b/ie/archive/2011/01/12/the-css-corner-css3-media-queries.aspx" title="http://blogs.msdn.com/b/ie/archive/2011/01/12/the-css-corner-css3-media-queries.aspx"></a></td> <td>9.5</td> <td>1.0 (?) <a class="external" href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariCSSRef/Articles/OtherStandardCSS3Features.html" title="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariCSSRef/Articles/OtherStandardCSS3Features.html"></a></td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>yes</td> <td>yes</td> <td>?</td> <td>yes</td> <td>yes</td> </tr> </tbody> </table>
</div>
<h2 name="See_also">See also</h2>
<ul> <li><a class="internal" href="/En/CSS/Media_queries" title="en/CSS/Media queries">CSS Media Queries</a></li> <li><a href="/en/CSS_Reference" title="CSS Reference">CSS Reference</a> Index</li> <li>CSS Data Types : {{ CSSDataTypes() }}</li>
</ul>
<div class="noinclude"> <p>{{ languages( { "ja": "ja/CSS/resolution" } ) }}</p>
</div>
Revert to this revision