---
id: bad87fee1248bd9aedf08824
challengeType: 0
videoUrl: 'https://scrimba.com/c/cg4RWh4'
forumTopicId: 16633
localeTitle: 给元素的每一侧添加不同的外边距
---
## Description
有时候,你会想给一个元素每个方向的margin
都设置成一个特定的值。
CSS 允许你使用margin-top
,margin-right
,margin-bottom
和margin-left
属性来设置四个不同方向的margin
值。
## Instructions
蓝色框的顶部和左侧的margin
值设置为40px
,底部和右侧设置为20px
。
## Tests
```yml
tests:
- text: 'blue-box
class 的右侧margin
(上外边距)值应为40px
。'
testString: assert($(".blue-box").css("margin-top") === "40px");
- text: 'blue-box
class 的右侧margin
(右外边距)值应为20px
。'
testString: assert($(".blue-box").css("margin-right") === "20px");
- text: 'blue-box
class 的底部margin
(下外边距)值应为20px
。'
testString: assert($(".blue-box").css("margin-bottom") === "20px");
- text: 'blue-box
class 的左侧margin
(左外边距)值应为40px
。'
testString: assert($(".blue-box").css("margin-left") === "40px");
```
## Challenge Seed
```html
margin
padding
padding
```
## Solution
```js
// solution required
```