Add arbitrary ratio docs

This commit is contained in:
Jeremy Thomas 2019-07-25 11:04:03 +01:00
parent 2650860c98
commit eb28457c3c
2 changed files with 23 additions and 1 deletions

View File

@ -7,6 +7,10 @@
* Fix #2031, Fix #2483 -> Invalid output when declaring a custom shade map * Fix #2031, Fix #2483 -> Invalid output when declaring a custom shade map
* Fix #2060 -> `height: auto` on HTML `audio` element breaks height of element * Fix #2060 -> `height: auto` on HTML `audio` element breaks height of element
### New features
* #2563 `.image` has a new `.is-fullwidth` modifier
## 0.7.5 ## 0.7.5
### Deprecation warning ### Deprecation warning

View File

@ -40,6 +40,12 @@ meta:
</figure> </figure>
{% endcapture %} {% endcapture %}
{% capture iframe_ratio %}
<figure class="image is-16by9">
<iframe class="has-ratio" width="640" height="360" src="https://www.youtube.com/embed/YE7VzlLtp-4?showinfo=0" frameborder="0" allowfullscreen></iframe>
</figure>
{% endcapture %}
<div class="content"> <div class="content">
<p>Because images can take a few seconds to load (or not at all), use the <code>.image</code> container to specify a <strong>precisely sized</strong> container so that your layout isn't broken because of image loading or image errors.</p> <p>Because images can take a few seconds to load (or not at all), use the <code>.image</code> container to specify a <strong>precisely sized</strong> container so that your layout isn't broken because of image loading or image errors.</p>
</div> </div>
@ -172,11 +178,23 @@ meta:
</table> </table>
<div class="content"> <div class="content">
<p>The <code>.image</code> container will take up the <strong>whole width</strong> while maintaining the perfect ratio.</p> <p>The <code>.image</code> container will usually take up the <strong>whole width</strong> while maintaining the perfect ratio.
<br>If it doesn't, you can force it by appending the <code>is-fullwidth</code> modifier.</p>
</div> </div>
{% include elements/anchor.html name="Arbitrary ratios with any element" %} {% include elements/anchor.html name="Arbitrary ratios with any element" %}
{% include elements/new-tag.html version="0.7.4" %} {% include elements/new-tag.html version="0.7.4" %}
<div class="content">
<p>
You can apply a specific <strong>ratio</strong> on <strong>any element</strong> other than an <code>img</code>, simply by applying the <code>.has-ratio</code> modifier to a resizable element.
</p>
<p>
For example, you can apply a <code>16by9</code> ratio on an <code>iframe</code>. Resize the browser, and you'll see how the ratio is maintained.
</p>
</div>
{% include elements/snippet.html content=iframe_ratio horizontal=true %}
{% include elements/variables.html type='element' %} {% include elements/variables.html type='element' %}