2.9 KiB
2.9 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d78a6367417b2b2512add | Create a Graphic Using CSS | 0 | 使用CSS创建图形 |
Description
box-shadow
的box-shadow
属性,以及控制元素角落圆度的border-radius
属性。您将创建一个圆形透明对象,其阴影略微偏向侧面 - 阴影实际上将是您看到的月亮形状。要创建圆形对象, border-radius
属性应设置为50%的值。您可以从之前的挑战中回想一下, box-shadow
属性采用offset-x
, offset-y
, blur-radius
, spread-radius
和颜色值的值。 blur-radius
和spread-radius
值是可选的。 Instructions
background-color
更改为透明,然后将border-radius
属性设置为50%以生成圆形。最后,更改box-shadow
属性,将offset-x
设置为25px, offset-y
为10px, blur-radius
为0, spread-radius
为0,颜色设置为蓝色。 Tests
tests:
- text: <code>background-color</code>属性的值应设置为<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: <code>border-radius</code>属性的值应设置为<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: <code>box-shadow</code>属性的值应设置为<code>offset-x</code>为25px, <code>offset-y</code>为10px, <code>blur-radius</code>为0, <code>spread-radius</code>为0,最后为颜色为蓝色。
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
// solution required