Skip to content

Commit 80c5ec1

Browse files
committed
Add font-size example to calc()
1 parent 698e254 commit 80c5ec1

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

css3-values/Overview.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,22 @@ <h3 id=calc><span class=secno>8.1. </span> Mathematical Expressions:
12581258
}</pre>
12591259
</div>
12601260

1261+
<div class=example>
1262+
<p>The following sets the &lsquo;<code
1263+
class=property>font-size</code>&rsquo; so that exactly 40em fits within
1264+
the viewport, ensuring that roughly the same amount of text always fills
1265+
the screen no matter the screen size.</p>
1266+
1267+
<pre>
1268+
:root {
1269+
font-size: calc(100vw / 40);
1270+
}</pre>
1271+
1272+
<p>If the rest of the design is specified using the &lsquo;<a
1273+
href="#rem-unit"><code class=css>rem</code></a>&rsquo; unit, the entire
1274+
layout will scale to match the viewport width.</p>
1275+
</div>
1276+
12611277
<p class=issue>Add less trivial examples, particularly involving parens or
12621278
nesting.
12631279

css3-values/Overview.src.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,17 @@ <h3 id="calc">
851851
}</pre>
852852
</div>
853853

854+
<div class="example">
855+
<p>The following sets the 'font-size' so that exactly 40em fits within the viewport, ensuring that roughly the same amount of text always fills the screen no matter the screen size.</p>
856+
857+
<pre>
858+
:root {
859+
font-size: calc(100vw / 40);
860+
}</pre>
861+
862+
<p>If the rest of the design is specified using the ''rem'' unit, the entire layout will scale to match the viewport width.</p>
863+
</div>
864+
854865
<p class='issue'>Add less trivial examples, particularly involving parens
855866
or nesting.</p>
856867

0 commit comments

Comments
 (0)