gpt4 book ai didi

ruby-on-rails-3 - 导轨 3 : Why does my image_tag automatically add inline style attributes to the HTML making it invisible?

转载 作者:行者123 更新时间:2023-12-04 23:03:48 24 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题,我在 Rails 3.0.12 应用程序的 View 中放置的图像标签会自动获得内联样式、宽度和高度属性,即使我没有分配它们并覆盖我的 CSS。

例如,如果我在某个 View 中有这个(我正在使用 Paperclip gem):

<%= image_tag @campaign.advertisement.image.url(:thumb), :class => "updateable image", 'update-from' => "campaign_advertisement_attributes_image" %>

渲染 View 中的结果是这样的:
<img alt="Stock-vector-whole" class="updateable image" src="/images/advertisements/12/thumb/stock-vector-whole.jpg?1370472026" style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 0px 0px;" update-from="campaign_advertisement_attributes_image" width="0" height="0">

如果我手动编写 img,结果完全相同在我看来,HTML 是这样的:
<img alt="Preview" class="updateable image" src="<%= @campaign.advertisement.image.url(:thumb) %>" update-from="campaign_advertisement_attributes_image">

这些内联样式属性,因为显示设置为无,可见性设置为隐藏,使图像不可见并覆盖我的样式表。

有谁知道为什么要设置这些属性以及如何禁用此行为?

感谢您的任何帮助。

最佳答案

这太愚蠢了。事实证明,我浏览器中的 Ad-block 插件阻止了图像可见,而不是我的应用程序中的某些内容。我的想法来自 this other answer .

关于ruby-on-rails-3 - 导轨 3 : Why does my image_tag automatically add inline style attributes to the HTML making it invisible?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16951481/

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