【问题标题】:ace editor is bigger than its parent div classace 编辑器比它的父 div 类大
【发布时间】:2018-02-12 10:18:59
【问题描述】:

我正在尝试在我的网页中使用 ace 编辑器。

王牌编辑器github:https://github.com/ajaxorg/ace

在html正文上,我像这样在div“第三页”中插入了ace editor div类

<div id="third-page" style="display: none;">
    <div id="editor"> test </div>
    <button class="btn btn-primary btn-lg" id="priv_3">Previous</button>
    <button class="btn btn-primary btn-lg" id="next_3">Next</button>
</div>

我按照 github 教程中的说明声明了样式表。

但它太小了,我想匹配它的父级大小。

我找到了相关的stackoverflow页面

How to get the ace editor to adjust to its parent div

并像这样尝试过

#editor {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

结果是这样的

div id "editor" 比它的父 "third-page" 大,我尝试了几件事,但它不起作用。

我该如何突破这个问题?

【问题讨论】:

    标签: javascript jquery html css ace-editor


    【解决方案1】:

    third-page 的位置设置为相对,以使其中的绝对定位子元素相对于该元素而不是 document.body

    【讨论】:

      猜你喜欢
      • 2015-05-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-16
      • 1970-01-01
      • 1970-01-01
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多