Skip to content

Commit 6909af1

Browse files
committed
Add some more calc() examples.
1 parent b2e78bd commit 6909af1

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

css3-values/Overview.src.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,35 @@ <h3 id="calc">
921921
<p>If the rest of the design is specified using the ''rem'' unit, the entire layout will scale to match the viewport width.</p>
922922
</div>
923923

924+
<div class='example'>
925+
<p>
926+
The following example stacks two centered background images,
927+
with one offset slightly from the other.
928+
929+
<pre>
930+
.foo {
931+
background: url(top.png), url(bottom.png);
932+
background-repeat: no-repeat;
933+
background-position: calc(50% + 20px) calc(50% + 20px), 50% 50%;
934+
}
935+
</pre>
936+
</div>
937+
938+
<div>
939+
<p>
940+
This example shows how to place color-stops on a gradient an equal distance from either end.
941+
942+
<pre>
943+
.foo {
944+
background-image: linear-gradient(to right, silver,
945+
white 50px,
946+
white calc(100% - 50px),
947+
silver);
948+
}
949+
</pre>
950+
</div>
951+
952+
924953
<p>The expression language of these functions is described by
925954
the grammar and prose below.
926955

0 commit comments

Comments
 (0)