如何通过CKEditor 4.0的默认模式覆盖网站模板的样式表

时间:2013-03-08 01:41:24

标签: javascript css asp.net-mvc ckeditor stylesheet

当我将CKEditor 4.0与没有任何样式或样式表相关联的HTML页面合并时,编辑器在展示子弹和数字时看起来很好。

但是,当我应用模板的样式表/ CSS时,集成的CKEditor组件开始不正确显示项目符号和数字。我的意思是它显示了网站的样式表的子弹,这些子弹完全没有为该上下文指定。对于例如子弹在每个文本条目的右侧显示为小图片。或者没有任何东西显示为1,2,3等等。

如何让CKEditor不使用网站的样式表,而是使用自己的样式表。代码段如下所示:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>FAQ</title>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="~/Content/themes/construct/stylesheets/style.css"> 
<link rel="stylesheet" href="~/Content/themes/construct/stylesheets/responsive.css"> 
<script src="~/Content/themes/construct/scripts/jquery.min.js"></script> 
<script src="~/Content/themes/construct/scripts/jquery.simpleFAQ-0.7.min.js"></script>  
<script src="~/Content/themes/construct/scripts/js_func.js"></script>
<script src="~/ckeditor/ckeditor.js"></script>

<script>
    $(function () {
        $('#faq').simpleFAQ();
    });
</script>

</head>
<body>
<div class="wraper">
 <header class="header">
 </header>
</div> 

 <!-- /top_title -->
 <!-- /faq_list -->
 <div class="faq_list">
  <ul class="filter">
   <li class="active all"><a href="#all">All</a></li>
   <li class="business"><a href="#business">Business</a></li>
   <li class="technical"><a href="#technical">Technical</a></li>
   <li class="miscellaneous"><a href="#miscellaneous">Miscellaneous</a></li>
  </ul>
  <ul id="faq">
    @foreach (var entry in Model.MyList)
    {
    <li class="all business">
        <p class="question">
            @entry.Question
        </p>
        @foreach (var newEntry in entry.List2)
        {            
            <div class="answer" id="editable" contenteditable="true">
                <h1>@newEntry.Header</h1>
                <p>@newEntry.Answer</p>
            </div>

            }
    </li>
        }
  </ul>
 </div>
 </body>
 </html>

感谢您的帮助。 Arash的

1 个答案:

答案 0 :(得分:0)

覆盖样式表的最佳方法是..

  1. 将相同的类复制到新文件中,并在默认站点后链接此文件。防爆。 默认值:

    .class1 {font:normal 12px Arial;}

  2. 重写

    .class1 {font: bold 12px Arial;}
    

    2 ..按照上一过程并将属性标记为!important。实施例..

    默认:

    .class1 {font: normal 12px Arial;padding:10px;}
    

    重写:

    .class1 {font: normal 12px Arial;padding-left:10px !important;}