---
id: 587d78a6367417b2b2512add
title: Create a Graphic Using CSS
challengeType: 0
videoUrl: ''
localeTitle: 使用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
```yml
tests:
- text: background-color
属性的值应设置为transparent
。
testString: 'assert(code.match(/background-color:\s*?transparent;/gi), "The value of the background-color
property should be set to transparent
.");'
- text: border-radius
属性的值应设置为50%
。
testString: 'assert(code.match(/border-radius:\s*?50%;/gi), "The value of the border-radius
property should be set to 50%
.");'
- text: box-shadow
属性的值应设置为offset-x
为25px, offset-y
为10px, blur-radius
为0, spread-radius
为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 box-shadow
property should be set to 25px for offset-x
, 10px for offset-y
, 0 for blur-radius
, 0 for spread-radius
, and finally blue for the color.");'
```
## Challenge Seed
## Solution
```js
// solution required
```