diff --git a/index.html b/index.html index babf40352..d9145c7ef 100644 --- a/index.html +++ b/index.html @@ -265,22 +265,25 @@

HTML

<div class="box-example"></div>
 

CSS

.box-example {
-  width: calc(100% - 60px);
+  height: 280px;
+  background: #222 url('https://image.ibb.co/fUL9nS/wolf.png') no-repeat;
+  background-position: calc(100% - 20px) calc(100% - 20px);
 }
 

Demo

+

If you want to align a background-image from right and bottom wasn't possible with just straight length values. So now it's possible using calc():

-
Box Example
+
Background-image in the right/bottom

Explanation

diff --git a/snippets/calc.md b/snippets/calc.md index 27b8b040a..7575afa5a 100644 --- a/snippets/calc.md +++ b/snippets/calc.md @@ -12,25 +12,30 @@ The function calc() allows to define CSS values with the use of mathematical exp ```css .box-example { - width: calc(100% - 60px); + height: 280px; + background: #222 url('https://image.ibb.co/fUL9nS/wolf.png') no-repeat; + background-position: calc(100% - 20px) calc(100% - 20px); } ``` #### Demo +If you want to align a background-image from right and bottom wasn't possible with just straight length values. +So now it's possible using calc(): +
-
Box Example
+
Background-image in the right/bottom