任何方式来显示一些重型风格的HTML与网站的其他样式隔离? [英] Any way to display some heavily-styled HTML in isolation from the rest of site's styles?

查看:762
本文介绍了任何方式来显示一些重型风格的HTML与网站的其他样式隔离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找出一种在客户网站上显示电子邮件简报的档案的方法。问题是,这些通讯充满了万亿的内联样式,这是伟大的看到他们在Outlook或任何地方,但他们不会看起来太热在一个否则漂亮的样式网站。

I am trying to figure out a way to display an archive of email newsletters on my client's site. The issue is that the newsletters are full of a zillion inline styles, which is great for seeing them in Outlook or wherever, but they're not looking too hot in an otherwise-nicely styled site.

我的目标是让我的客户能够复制生成的通讯的整个源代码(她的列表管理公司允许她访问),并将其粘贴到CMS(drupal,如果它有所不同)。

My goal is for my client to be able to copy the entire source code of a generated newsletter (which her list management company* gives her access to) and paste it into the CMS (drupal, if it makes a difference).

*常客联系?邮件Chimp?我忘了。其中之一。

*Constant Contact? Mail Chimp? I forget. One of those.

然后我想显示在她的网站上,在网站的其余部分的基本结构(header,nav等)。如果这是1997年,我会说iframes!并使用它,但A)似乎是一个跛脚的解决方案和B)代码实际上不存在于一个页面本身,我认为是iframe所需。

Then I'd like to display it on her site, inside the basic structure (header, nav, etc) of the rest of the site. If this was 1997, I'd say "iframes!" and be done with it, but A) that seems like a lame solution, and B) the code doesn't actually exist on a page by itself, which I think is required for iframes.

有没有一些标签我可以围绕这个HTML块,以隔离其余的网站的样式?

Is there some kind of tag I can put around this block of HTML to isolate it from the rest of the site's styles? Or is there another way to go about this entirely?

谢谢!

推荐答案

IFrames是我曾经能够找到的唯一途径。唯一的替代方法是在父页面的CSS中覆盖通讯显示区域中的每个样式。

IFrames are the only way to go that I've ever been able to find. The only alternative to this would be to override every style in the parent page's CSS for the newsletter display area.

正如你所说的,使用iframe可能需要你托管通讯在一个独立的文件。我知道的唯一的替代方法是,你可以使用JavaScript来动态创建和/或填充iframe。

As you noted, using an iframe will probably require you to host the newsletters in an independent file. The only alternative to this that I'm aware of is that you can use JavaScript to dynamically create and/or populate the iframe.

如果你使用这种方法,你可以将通讯呈现在具有特定类的div中,然后使用JavaScript将div移动到iframe中。最大的缺点是,对于没有启用JavaScript的用户,这不会发生。

If you go with this method, you could have the newsletter present in a div with a specific class, and then use JavaScript to move the div into an iframe. The big downside being that this wouldn't happen for users without JavaScript enabled.

这篇关于任何方式来显示一些重型风格的HTML与网站的其他样式隔离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆