gpt4 book ai didi

javascript - 如何更改 reddit 的嵌入评论 iframe 的最大宽度?

转载 作者:太空宇宙 更新时间:2023-11-04 10:04:47 25 4
gpt4 key购买 nike

Reddit 提供了将他们的评论嵌入网站的代码,

例如:

<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="24a3e666-f855-4664-8e9e-9d040fef3ca6" data-embed-created="2016-06-29T16:56:02.732Z">
<a href="https://www.reddit.com/r/Showerthoughts/comments/2safxv/we_should_start_keeping_giraffes_a_secret_from/cno7zic">Comment</a> from discussion <a href="https://www.reddit.com/r/Showerthoughts/comments/2safxv/we_should_start_keeping_giraffes_a_secret_from/">We should start keeping giraffes a secret from young children. Imagine discovering giraffes exist when you were like 15. &quot;Woah! Check out that long necked horse!&quot;</a>.
</div>
<script async src="https://www.redditstatic.com/comment-embed.js"></script>

当您将其粘贴到 HTML 时,它会呈现包含内容的 iframe

iframe

max-width 属性设置为 800px,如何将其更改为其他值或 none ?

Fiddle

最佳答案

为了覆盖您无权访问的内联样式,您需要使用 !important(这是您需要使用 !important 的极端情况,否则避免)

iframe {
max-width: none !important
}
<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="24a3e666-f855-4664-8e9e-9d040fef3ca6" data-embed-created="2016-06-29T16:56:02.732Z"><a href="https://www.reddit.com/r/Showerthoughts/comments/2safxv/we_should_start_keeping_giraffes_a_secret_from/cno7zic">Comment</a> from discussion <a href="https://www.reddit.com/r/Showerthoughts/comments/2safxv/we_should_start_keeping_giraffes_a_secret_from/">We should start keeping giraffes a secret from young children. Imagine discovering giraffes exist when you were like 15. &quot;Woah! Check out that long necked horse!&quot;</a>.</div>
<script
async src="https://www.redditstatic.com/comment-embed.js"></script>

关于javascript - 如何更改 reddit 的嵌入评论 iframe 的最大宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38105963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com