Files
freeCodeCamp/guide/chinese/html/attributes/img-width-attribute/index.md
2018-10-16 21:32:40 +05:30

28 lines
689 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Img Width Attribute
localeTitle: Img宽度属性
---
## Img宽度属性
HTML“width”属性指的是图像的宽度。引号中的值是像素数量。
例如,如果您已经通过`src`属性设置了图像链接则可以添加width属性如下所示
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Img Width Attribute</title>
</head>
<body>
<img src="image.png" alt="Image" width="100"/>
</body>
</html>
```
在上面的代码段中有一个图像标记图像的宽度设置为100像素。 `width="100"`
#### 更多信息:
[关于img标签的MDN文章](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)