--- id: bad87fee1348bd9bedf08813 title: Add Borders Around Your Elements challengeType: 0 guideUrl: 'https://chinese.freecodecamp.org/guide/certificates/add-borders-around-your-elements' videoUrl: '' localeTitle: 添加元素周围的边框 --- ## Description
CSS边框具有stylecolorwidth等属性。例如,如果我们想要在HTML元素周围创建一个红色的5像素边框,我们可以使用此类:
<风格>
.thin-red-border {
边框颜色:红色;
border-width:5px;
边框式:坚固;
}
</样式>
## Instructions
创建一个名为thick-green-border 。这个类应该在HTML元素周围添加一个10px的实心绿色边框。将课程应用于您的猫照片。请记住,您可以使用其class属性将多个类应用于元素,方法是使用空格分隔每个类名。例如: <img class="class1 class2">
## Tests
```yml tests: - text: 您的img元素应该具有smaller-image类。 testString: 'assert($("img").hasClass("smaller-image"), "Your img element should have the class smaller-image.");' - text: 你的img元素应该有类thick-green-border 。 testString: 'assert($("img").hasClass("thick-green-border"), "Your img element should have the class thick-green-border.");' - text: 为图像提供10px的边框宽度。 testString: 'assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12, "Give your image a border width of 10px.");' - text: 为您的图像提供solid的边框样式。 testString: 'assert($("img").css("border-right-style") === "solid", "Give your image a border style of solid.");' - text: img元素周围的边框应为绿色。 testString: 'assert($("img").css("border-left-color") === "rgb(0, 128, 0)", "The border around your img element should be green.");' ```
## Challenge Seed
```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


```
## Solution
```js // solution required ```