3.2 KiB
3.2 KiB
id | title | challengeType | videoUrl |
---|---|---|---|
587d78a6367417b2b2512add | Create a Graphic Using CSS | 0 | https://scrimba.com/c/cEDWPs6 |
Description
box-shadow
property that sets the shadow of an element, along with the border-radius
property that controls the roundness of the element's corners.
You will create a round, transparent object with a crisp shadow that is slightly offset to the side - the shadow is actually going to be the moon shape you see.
In order to create a round object, the border-radius
property should be set to a value of 50%.
You may recall from an earlier challenge that the box-shadow
property takes values for offset-x
, offset-y
, blur-radius
, spread-radius
and a color value in that order. The blur-radius
and spread-radius
values are optional.
Instructions
background-color
to transparent, then set the border-radius
property to 50% to make the circular shape. Finally, change the box-shadow
property to set the offset-x
to 25px, the offset-y
to 10px, blur-radius
to 0, spread-radius
to 0, and color to blue.
Tests
tests:
- text: The value of the <code>background-color</code> property should be set to <code>transparent</code>.
testString: assert(code.match(/background-color:\s*?transparent;/gi), 'The value of the <code>background-color</code> property should be set to <code>transparent</code>.');
- text: The value of the <code>border-radius</code> property should be set to <code>50%</code>.
testString: assert(code.match(/border-radius:\s*?50%;/gi), 'The value of the <code>border-radius</code> property should be set to <code>50%</code>.');
- text: The value of the <code>box-shadow</code> property should be set to 25px for <code>offset-x</code>, 10px for <code>offset-y</code>, 0 for <code>blur-radius</code>, 0 for <code>spread-radius</code>, and finally blue for the color.
testString: assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi), 'The value of the <code>box-shadow</code> property should be set to 25px for <code>offset-x</code>, 10px for <code>offset-y</code>, 0 for <code>blur-radius</code>, 0 for <code>spread-radius</code>, and finally blue for the color.');
Challenge Seed
<style>
.center
{
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100px;
height: 100px;
background-color: blue;
border-radius: 0px;
box-shadow: 25px 10px 10px 10px green;
}
</style>
<div class="center"></div>
Solution
var code = ".center {background-color: transparent; border-radius: 50%; box-shadow: 25px 10px 0px 0 blue;}"