【问题标题】:change style of selected text in tinymce editor (not blue background highlight)在 tinymce 编辑器中更改所选文本的样式(不是蓝色背景突出显示)
【发布时间】:2013-06-04 14:14:29
【问题描述】:

如何在 TinyMCE 编辑器中设置用户选择/突出显示文本的背景?我不想要蓝色背景和白色前景的默认选择样式。我怎样才能改变它?这些是我在 TinyMCE 主题文件的content.css 文件中的绝望尝试,但它们并没有带来任何改变!

.mceContentBody::-moz-selection { background: transparent !important; }
.mceContentBody::selection { background: transparent !important; }    
.mceContentBody::-webkit-selection { background: transparent !important; }

#tinymce::-moz-selection { background: transparent !important; }
#tinymce::selection { background: transparent !important; }    
#tinymce::-webkit-selection { background: transparent !important; }

:-moz-selection { background: transparent !important; }
::selection { background: transparent !important; }    
::-webkit-selection { background: transparent !important; }

p:-moz-selection { background: transparent !important; }
p::selection { background: transparent !important; }    
p::-webkit-selection { background: transparent !important; }

span:-moz-selection { background: transparent !important; }
span::selection { background: transparent !important; }    
span::-webkit-selection { background: transparent !important; }

请帮忙!

相关TinyMCE元素的HTML代码为:

<iframe>
<html>
<head>...</head>
<body id='tinymce' class='mceContentBody'>...
<p> <span> Here is the text that should have a transparent background when highlighted by the user </span> </p>
</body>
</html>
</iframe>

【问题讨论】:

    标签: css tinymce format selection highlight


    【解决方案1】:

    好的,我能够通过不更改直接 TinyMCE 主题文件来解决这个问题。 相反,我在从 tinyMCE init 函数调用的外部 CSS 文件之一中添加了选择 CSS 规则。然后就成功了。

    【讨论】:

    • 规则是什么?
    猜你喜欢
    • 1970-01-01
    • 2015-02-10
    • 1970-01-01
    • 2019-07-06
    • 2014-01-15
    • 1970-01-01
    • 2014-03-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多