重新着色图片广告以匹配网站主题
这样做的最佳方法是什么?我想在网站上应用 Photoshop 式的图像广告颜色叠加。最好通过 CSS,但 javascript 也可以。我的第一个想法是放置一个具有与广告 div 相同宽度和高度的颜色的 div,并对其应用不透明度设置,以便它混合在一起。想法?
What would be the best method of going about doing this? I want to essentially apply a photoshop-esque color overlay of image ads on a website. Preferably through CSS, but javascript would work too. My first idea was placing a div with the color I intend with the same width and height as the ad div, and applying an opacity setting to it so that it blends together. Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我们谈论的是 Google AdSense,我很确定您不允许这样做,请阅读 Google AdSense 政策页面。
也就是说,唯一合理的解决方案是使用混合,但这会产生糟糕的结果,并且您直接违反了
被页面上的元素遮挡
策略规则。If it's Google AdSense we're talking about, I'm pretty sure you're not allowed to do that, read the Google AdSense policies page.
That said, the only reasonable solution would be using blending, but that gives awful results, and you're directly breaking the
Obscured by elements on a page
policy rule.首先,我认为你的广告商不会高兴你改变他们的广告的配色方案(考虑品牌颜色等),但它应该是可行的。
使用具有背景颜色和不透明度的叠加层可能不会产生最令人满意的结果,但这是朝着您想要实现的目标迈出的一步。唯一的问题是覆盖层会使链接无法点击,因此必须这样做,以便广告图像位于底部,并且覆盖层实际上是链接。例如,这可能有效:
在 CSS 中:
First of all, I dont think your advertisers would be happy at you changing the color scheme of their ads (think about brand colors etc), but it should be doable nevertheless.
Using a overlay with a background color and a opacity might not give the most pleasing result, but it's a step toward what you're trying to achieve. The only problem is that the overlay will make the link unclickable, so it has to be done so that the image for the ad is at the bottom, and the overlay is actually the link. For example, this might work:
And in CSS: