如何在CKEditor上设置默认字体大小 [英] How to set default font-size on CKEditor
问题描述
我在设置CKEditor实例的默认字体大小时出现问题。我尝试了谷歌搜索,但没有找到任何答案我的问题。
I am having a problem setting a default font-size for a CKEditor Instance. I have tried googling but found nothing that answers my question.
我有一个页面,需要输入一个网站。有3个编辑器实例,我必须使第一个实例的默认字体大小,说约20到30像素。
I have a page which takes an input for a website. There are 3 Editor instances and I have to make the default font-size of the first instance to, say about 20 to 30px.
我已经尝试修改contents.css发现在CKEDITOR文件夹中,并更改字体大小但影响所有3个编辑器实例
I have tried modifying contents.css found inside CKEDITOR folder and changing the font-size there but it affects all the 3 editor instances
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
body
{
/* Font */
font-family: Georgia;
font-size: 12px;
/* Text color */
color: #222;
/* Remove the background color to make it transparent */
background-color: #fff;
}
ol,ul,dl
{
/* IE7: reset rtl list margin. (#7334) */
*margin-right:0px;
/* preserved spaces for rtl list item bullets. (#6249)*/
padding-right:40px;
}
任何人都能找出如何解决这个问题?
任何帮助非常感谢!
Anybody have been able to figure out how to solve this? Any help is very much appreciated!..
提前谢谢你们。
mhond
推荐答案
我希望上面的答案帮助一些人。他们没有帮助我,这里是为什么。使用firebug,我可以看到about:blank具有p标签的默认字体,这覆盖了我在上面提到的contents.css文件中的设置。这里是我做了修复它。我添加了ap到body标签并添加!对font-family和font-size行很重要:
I hope the answers above help some people. They did not help me and here's why. Using firebug, I could see that about:blank had a default font for the p tag which overrode my setting in the contents.css file as mention above. Here's what I did to fix it. I added a p to the body tag and added !important to the font-family and font-size lines:
body, p {
/* Font */
font-family: Arial, Verdana, sans-serif !important;
font-size: 12px !important;
/* Text color */
color: #000;
/* Remove the background color to make it transparent */
background-color: #fff;
}
我希望这有助于。
这篇关于如何在CKEditor上设置默认字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!