--- id: bad87fee1348bd9acdf08812 challengeType: 0 videoUrl: 'https://scrimba.com/c/cM9MmCP' forumTopicId: 18282 title: 调整图片的大小 --- ## Description
CSS 的width属性可以控制元素的宽度。图片的width宽度类似于字体的px(像素)值。 假如,你想创建一个叫larger-image的 CSS class 来控制 HTML 元素的宽度为 500px,我们可以这样做: ```html ```
## Instructions
创建一个smaller-image的 CSS class,设置图片的宽度为 100px。 注意:
由于不同浏览器的差异性,你可能需要将浏览器缩放到 100% 来通过该挑战。
## Tests
```yml tests: - text: 'img元素应该含有smaller-image class。' testString: assert($("img[src='https://bit.ly/fcc-relaxing-cat']").attr('class') === "smaller-image"); - text: '图片宽度应为 100px(像素),且浏览器缩放应为默认 100%。' testString: assert($("img").width() === 100); ```
## Challenge Seed
```html

CatPhotoApp

点击查看更多猫图.

一只仰卧着的萌猫

猫咪最喜欢的三件东西:

  • 猫薄荷
  • 激光笔
  • 千层饼

猫咪最讨厌的三件东西:

  1. 跳蚤
  2. 打雷
  3. 同类


```
## Solution
```js // solution required ``` /section>