# iFrame 在帖子中的首个项目时会移除内容

**URL:** https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121
**Category:** Development
**Created:** [2024年四月2日 21:49 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121 "2024-04-02T21:49:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [2024年四月2日 21:49 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121/1 "2024-04-02T21:49:24Z")

</div>

如果在帖子中，我在文本内容下方放置了一个 iframe，该 iframe 会显示在文本下方，但如果我将 iframe 放在文本内容上方，该 iframe 会显示，但文本会消失。

我感到困惑，我想这可能与内容的“烹饪”方式有关，但不确定为什么会这样。

有什么想法是什么原因吗？

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2024年四月2日 22:43 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121/2 "2024-04-02T22:43:16Z")

</div>

我无法重现。文本有什么特别之处吗？🤔

 ![图片显示了一个电脑屏幕，左侧有一个带有文本的编辑器和一个嵌入式 iframe 代码片段的网页界面，右侧是标题为“Smooth Flexbox Navigation”的 CodePen 项目预览，并带有运行代码和查看 HTML、CSS 和 JS 选项卡。(由 AI 标注)](https://global.discourse-cdn.com/meta/original/4X/1/e/4/1e44a130630e5b1fea3950c295bab4873871a27a.png)

---

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [2024年四月2日 22:47 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121/3 "2024-04-02T22:47:13Z")

</div>

哦，我很感激你试图重现它。我正在使用一个 `<details>` 标签，所以也许是这个原因，或者是我这边有冲突的组件。

不过很高兴知道这可能是我的问题，我会进一步研究，谢谢！

---

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [2024年四月3日 04:24 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121/4 "2024-04-03T04:24:43Z")

</div>

我只放了 `<iframe src="https://www.example.com">` 而没有包含闭合标签 `</iframe>`。

我加上它之后就工作了 🤦‍♂️

谢谢你帮我意识到是我的问题 🤗

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2024年五月3日 04:25 UTC](https://meta.discourse.org/t/iframe-removes-content-if-first-item-in-post/302121/5 "2024-05-03T04:25:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
