---
id: bad87fee1348bd9aedf08824
title: Add Different Padding to Each Side of an Element
challengeType: 0
guideUrl: 'https://chinese.freecodecamp.org/guide/certificates/add-different-padding-to-each-side-of-an-element'
videoUrl: ''
localeTitle: 在元素的每一侧添加不同的填充
---
## Description
有时您会想要自定义一个元素,使其每边都有不同数量的padding
。 CSS允许您控制的padding
与元素的所有四个单项两侧padding-top
, padding-right
, padding-bottom
,并padding-left
属性。
## Instructions
在蓝色框的顶部和左侧给出40px
的padding
,但在其底部和右侧只有20px
。
## Tests
```yml
tests:
- text: 你的blue-box
类应该给出40px
padding
元素的顶部。
testString: 'assert($(".blue-box").css("padding-top") === "40px", "Your blue-box
class should give the top of the elements 40px
of padding
.");'
- text: 你的blue-box
类应该给出20px
padding
元素的权利。
testString: 'assert($(".blue-box").css("padding-right") === "20px", "Your blue-box
class should give the right of the elements 20px
of padding
.");'
- text: 你的blue-box
类应该给出20px
padding
元素的底部。
testString: 'assert($(".blue-box").css("padding-bottom") === "20px", "Your blue-box
class should give the bottom of the elements 20px
of padding
.");'
- text: 你的blue-box
类应该给元素左边padding
40px
。
testString: 'assert($(".blue-box").css("padding-left") === "40px", "Your blue-box
class should give the left of the elements 40px
of padding
.");'
```
## Challenge Seed
```html
margin
padding
padding
```
## Solution
```js
// solution required
```