---
id: bad87fee1348bd9aedf08823
title: Add a Negative Margin to an Element
challengeType: 0
guideUrl: 'https://chinese.freecodecamp.org/guide/certificates/add-a-negative-margin-to-an-element'
videoUrl: ''
localeTitle: 向元素添加负边距
---
## Description
元素的margin
控制元素border
与周围元素之间的空间量。如果将元素的margin
设置为负值,则元素将变大。
## Instructions
尝试将margin
设置为负值,如红色框的值。将蓝色框的margin
更改为-15px
,因此它会填充其周围黄色框的整个水平宽度。
## Tests
```yml
tests:
- text: 你的blue-box
类应该给出-15px
的margin
元素。
testString: 'assert($(".blue-box").css("margin-top") === "-15px", "Your blue-box
class should give elements -15px
of margin
.");'
```
## Challenge Seed
```html
padding
padding
```
## Solution
```js
// solution required
```