【问题标题】:How to change the background-image in ace editor?如何在 ace 编辑器中更改背景图像?
【发布时间】:2017-04-23 12:09:21
【问题描述】:

我在 CSS 中尝试过,但没有成功。我还尝试了保存在 我的电脑

.ace_identifier{
 background-image : url("https://www.google.com.eg/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwji1duTxbrTAhUEOBQKHamBCvQQjRwIBw&url=https%3A%2F%2Fox-fest.org%2F2017%2F02%2F06%2Fupcoming-workshop-coding-with-morgan-stanley%2F&psig=AFQjCNECub5OZqaxX9R684Gm4HLX-X7Zdw&ust=1493035590367032");
}

.ace_identifier{ 背景图片: url("https://s-media-cache-ak0.pinimg.com/564x/1c/da/05/1cda057bcd14d46c68e3051dc26f6850.jpg"); }

编辑: 我尝试了一个有效的 url。同样的问题

【问题讨论】:

  • 您的网址无效?
  • @DanielH 我尝试了另一个。
  • 你想给整个编辑器添加背景图片还是给特定的词添加背景图片,它应该在装订线后面吗?

标签: javascript html css editor ace-editor


【解决方案1】:

如果将 css 应用于正确的选择器,它应该可以工作,并确保没有覆盖它的规则。

<script src=http://ajaxorg.github.io/ace-builds/src-noconflict/ace.js></script>
<script>
var editor = ace.edit()
// set class to editor to use in css,
// could use .ace_editor too, but that
// would match all editors on the page
editor.container.classList.add("myEditor")
editor.setTheme("ace/theme/monokai")
editor.setValue("some text here", -1)
document.body.appendChild(editor.container)
</script>

<style>
.myEditor {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;  
  background :  url(https://s-media-cache-ak0.pinimg.com/564x/1c/da/05/1cda057bcd14d46c68e3051dc26f6850.jpg);
}
}

</style>

【讨论】:

  • 你先生,真是个天才!太感谢你了!!!我从没想过容器方法!谢谢你:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-20
  • 1970-01-01
  • 2013-04-22
  • 1970-01-01
相关资源
最近更新 更多