# Iframeのサイズが正しくありません

**URL:** <https://meta.discourse.org/t/iframe-is-not-the-correct-size/249820>\
**Category:** Product Support\
**Created:** [2022 年 12 月 25 日午前 1:20 UTC](https://meta.discourse.org/t/iframe-is-not-the-correct-size/249820 "2022-12-25T01:20:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2022 年 12 月 25 日午前 1:51 UTC](https://meta.discourse.org/t/iframe-is-not-the-correct-size/249820/2 "2022-12-25T01:51:25Z")

</div>

iframe の `width` と `height` を絶対値に設定する必要があります。また、幅と高さは `style` 属性ではなく、iframe の属性として設定する必要があります（Discourse は投稿を処理する際に style 属性を削除します）。

以下は、YouTube iframe からコピーした例です。

```plaintext
<iframe width="560" height="315" src="https://www.youtube.com/embed/r-i6XpcL1Fs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

```

Discourse の投稿で使用できる最大幅は `600` だと思います。スクリーンショットの iframe コードを使用しても問題ないはずですが、開いている iframe タグの後に `width="600" height="400"` を追加してください。幅と高さの値は、うまくいくものを試すことができます。

---

_[View the full topic](https://meta.discourse.org/t/iframe-is-not-the-correct-size/249820)._
