---
id: bad87fee1248bd9aedf08824
title: Add Different Margins to Each Side of an Element
challengeType: 0
videoUrl: ''
localeTitle: 在元素的每一侧添加不同的边距
---
## Description
有时您会想要自定义元素,使其每边都有不同的margin 。 CSS允许您控制的margin与元素的所有四个单项两侧margin-top , margin-right , margin-bottom ,和margin-left属性。
## Instructions
蓝色框的顶部和左侧margin为40px ,底部和右侧仅为20px 。
## Tests
```yml
tests:
- text: 你的blue-box类应该给元素顶部40px的margin 。
testString: 'assert($(".blue-box").css("margin-top") === "40px", "Your blue-box class should give the top of elements 40px of margin.");'
- text: 您的blue-box类应该赋予元素20px margin的权利。
testString: 'assert($(".blue-box").css("margin-right") === "20px", "Your blue-box class should give the right of elements 20px of margin.");'
- text: 你的blue-box类应该给元素的底部提供20px的margin 。
testString: 'assert($(".blue-box").css("margin-bottom") === "20px", "Your blue-box class should give the bottom of elements 20px of margin.");'
- text: 你的blue-box类应该给元素左边40px的margin 。
testString: 'assert($(".blue-box").css("margin-left") === "40px", "Your blue-box class should give the left of elements 40px of margin.");'
```
## Challenge Seed
```html
margin
padding
padding
```
## Solution
```js
// solution required
```