3.2 KiB
3.2 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
587d78a6367417b2b2512add | Create a Graphic Using CSS | 0 | https://scrimba.com/c/cEDWPs6 | 301048 | 使用 CSS 创建一个图形 |
Description
box-shadow
属性来设置元素的阴影,border-radius
属性控制元素的圆角边框。
首先你将会创建一个圆的、透明的对象,它具有模糊阴影并略微向两边递减。如你所见,这个阴影其实就是新月形狀。
为了创建一个圆形的对象,border-radius
应该被设置成 50%。
你应该还记得之前关卡的 box-shadow
属性以及它的依次取值 offset-x
、offset-y
、blur-radius
、spread-radius
和颜色值。其中blur-radius
和 spread-radius
是可选的。
Instructions
background-color
改为 transparent,接着把 border-radius
属性设置成 50%,以创建一个圆形。最后,更改 box-shadow
属性,使其 offset-x
为 25px,offset-y
为 10px,blur-radius
为 0,spread-radius
为 0,color
为 blue。
Tests
tests:
- text: '<code>background-color</code> 属性应该取值 <code>transparent</code>。'
testString: 'assert(code.match(/background-color:\s*?transparent;/gi), ''<code>background-color</code> 属性应该取值 <code>transparent</code>。'');'
- text: '<code>border-radius</code> 属性应该取值 <code>50%</code>。'
testString: 'assert(code.match(/border-radius:\s*?50%;/gi), ''<code>border-radius</code>属性应该取值<code>50%</code>。'');'
- text: '<code>box-shadow</code> 属性的 <code>offset-x</code>、<code>offset-y</code>、<code>blur-radius</code>、<code>spread-radius</code> 和 <code>color</code> 应该依次取值<code>25px</code>、<code>10px</code>、<code>0</code>、<code>0</code> 和 <code>blue</code>。'
testString: 'assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi), ''<code>box-shadow</code> 属性的 <code>offset-x</code>、<code>offset-y</code>、<code>blur-radius</code>、<code>spread-radius</code> 和 <code>color</code> 应该依次取值<code>25px</code>、<code>10px</code>、<code>0</code>、<code>0</code> 和 <code>blue</code>。'');'
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