/
index.md
43 lines (30 loc) · 1006 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
title: "HTMLIFrameElement: width property"
short-title: width
slug: Web/API/HTMLIFrameElement/width
page-type: web-api-instance-property
browser-compat: api.HTMLIFrameElement.width
---
{{APIRef("HTML DOM")}}
The **`width`** property of the {{domxref("HTMLIFrameElement")}} interface returns a string that reflects the `width` attribute of the {{HTMLElement("iframe")}} element, indicating the width of the frame in CSS pixels.
## Value
A string indicating the width of the frame in CSS pixels.
## Examples
```html
<iframe id="el" width="800" height="600"></iframe>
```
```js
const el = document.getElementById("el");
console.log(el.width); // Output: '800'
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("HTMLCanvasElement.width")}}
- {{domxref("HTMLEmbedElement.width")}}
- {{domxref("HTMLImageElement.width")}}
- {{domxref("HTMLObjectElement.width")}}
- {{domxref("HTMLSourceElement.width")}}
- {{domxref("HTMLVideoElement.width")}}