css - CKEditor 动态设置文本区域边距

标签 css ckeditor wysiwyg rich-text-editor

我在 CKEditor 中遇到问题,无法在每个动态模板中设置边距。现在我正在做的是直接进入 content.css

我的问题是如何直接从 php 模块设置边距。

这是我直接命中的content.css

body
{
    /* Font */
    font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
    font-size: 12px;

    /* Text color */
    color: #333;

    /* Remove the background color to make it transparent */
    background-color: #fff;

    /*margin: 113px 94px 151px 113px; */
    margin: 3cm 2.5cm 4cm 3cm;
}

谢谢, 亨德拉

最佳答案

在 ckeditor textarea/div 之外创建一个 div,并为外部 div 留出边距。

<div id = "ckeContainer">
    <textarea name="editor1">This textarea is used for CKeditor</textarea>
</div>

<script>
    document.getElementById('ckeContainer').style.margin="3px 2px 3px 4px";
</script>

编辑

您也可以尝试以下 Javascript:

document.body.style.margin = "3px 2px 3px 4px";

希望对您有所帮助!

关于css - CKEditor 动态设置文本区域边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37582364/

相关文章:

javascript - 未为直接子元素返回元素高度

css - 在 IE 6 和 IE 7 中推出的文本框背景图片

javascript - 使用带有 Twitter Bootstrap 按钮的 wysihtml5 工具栏

javascript - 向 CKEditor 添加本地插件

css - 为什么 big negative margin-right 让 absolute 元素不换行?

javascript - 在 ckeditor 中为按键添加事件监听器代码

php - 在php中删除带有br标签的p标签

css - 强制 CKEditor 添加一个类到 p-tags

html - 强制标签在动态文本中关闭

css - 用 CSS 定位这个元素?