31 lines
680 B
Markdown
Raw Normal View History

---
id: bad87fee1348bd9aedf08823
title: 给元素添加负外边距
challengeType: 0
videoUrl: 'https://scrimba.com/c/cnpyGs3'
forumTopicId: 16166
---
# --description--
元素的`margin外边距`控制元素`border边框`与其他周围元素之间的距离大小。
如果你把元素的`margin`设置为负值,元素会变得更大。
# --instructions--
尝试将蓝色框的`margin`设为负值,跟红色框一样大小。
蓝色框的`margin`设置为`-15px`,它会填满与黄色框之间的距离。
# --hints--
`blue-box` class的`margin`应该设置为`-15px`
```js
assert($('.blue-box').css('margin-top') === '-15px');
```
# --solutions--