为页面的某个区域重置CSS? [英] Reset CSS for a certain area of the page?

查看:134
本文介绍了为页面的某个区域重置CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CMS。它的一个功能是在WYSIWYG编辑器中编辑作为单独页面显示的HTMLchunks。



我在CMS中有一个区域预览这些块。



这些块依赖于一个加载到WYSIWYG编辑器中的foundation.css文件。它会做一些小的重置,定义一个默认的字体和文本颜色,并且整体很简单。



CMS显然有很多的CSS语句,其影响像字体大小,族,颜色,线高度,填充等的一般设置。

当然,当我尝试在CMS页面中显示一个HTML块时,它看起来不同于只显示了foundation.css样式表。



任何人都可以想办法清除HTML页面(比如说,DIV)中所有以前的样式定义中定义的区域?我不能。




  • 显示块和嵌入foundation.css的Iframe会有所帮助,但我担心用户的工作流程当需要渲染5-10个IFrame,然后通过JS调整高度,一旦它们被加载。 Yuck。


  • 我已经考虑过将所有其他CSS提升到一个子类(即调整CMS的CSS),但这将涉及触摸很多文件,一些可能是PHP源代码,我宁愿不这样做。




认为这有一个解决方案,但你永远不知道。

解决方案

你可以给所有的divs包含WYSIWYG编辑器的代码a类,然后重置该div中的所有内容。


I am working on a CMS. One of its functions is the editing of HTML "chunks" in a WYSIWYG editor that are displayed as individual pages.

I have an area in the CMS where these chunks are previewed.

The chunks rely on a "foundation.css" file that is loaded into the WYSIWYG editor. It does some small resets, defines a default font and text color, and is overall very simple.

The CMS, obviously, comes with a ton of CSS statements, many of which affect general settings like font size, family, color, line-height, paddings and the like.

Naturally, when I try to display a HTML chunk in a CMS page, it looks different from when it is displayed only with the foundation.css stylesheet.

Can anybody think of a way to clean a defined area in a HTML page (say, a DIV) from all previous style definitions? I can't.

  • an Iframe displaying the chunk and embedding foundation.css would help, but I fear for the user's workflow when 5-10 IFrames have to be rendered and then adjusted in height via JS once they are loaded. Yuck.

  • I have thought about "lifting" all other CSS to a sub-class (i.e. adjusting the CMS' CSS), but that would involve touching a lot of files, some probably PHP source code, and I'd rather not do that.

I don't think this has a solution but you never know.

解决方案

you could give all of the divs that contain code from the WYSIWYG editor a class, and then reset everything inside of that div.

这篇关于为页面的某个区域重置CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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