kindeditor使用方法,kindeditor怎麼設定長寬度?

Tags: 寬度,

kindeditor是一款非常不錯的線上html編輯器,很多網站都在用。但是很多新手還不知道kindeditor怎麼用。下面小編就來介紹一下kindeditor使用方法,kindeditor怎麼設定長寬度

工具/原料

kindeditor相關檔案

Dreamweaver CS6

方法/步驟

首先我們需要kindeditor及其相關檔案,這些檔案可以去網上找,很容易找到。

kindeditor使用方法,kindeditor怎麼設定長寬度

下載完成後會看到很多檔案,但是我們只需要其中的三個主要檔案,如下圖,把這三個檔案拷貝到你的專案中,不要忘記jQuery檔案。

kindeditor使用方法,kindeditor怎麼設定長寬度

kindeditor使用方法,kindeditor怎麼設定長寬度

然後就是使用方法了,其實這個kindeditor就是把textare框美化了一下,添加了一些功能。所以在html中,我們需要有一個textare框,給它一個id。

kindeditor使用方法,kindeditor怎麼設定長寬度

kindeditor使用方法,kindeditor怎麼設定長寬度

之後我們需要引入jQuery及kindeditor的js檔案,其它的檔案kindeditor會自動呼叫,不必手動引用。然後在js中寫相關的語句就可以了,如下圖:

kindeditor使用方法,kindeditor怎麼設定長寬度

kindeditor使用方法,kindeditor怎麼設定長寬度

kindeditor的長度和寬度都可以通過引數來設定,其中width來設定寬度,最好用百分數,height來設定高度。

KindEditor.create('#editor_id',{allowImageUpload:false,resizeType : 1,width:"50%",height:"200px"});

kindeditor使用方法,kindeditor怎麼設定長寬度

除了用引數設定kindeditor大小之外,我們看html原始碼還可以看到kindeditor大小由class為ke-container和ke-container-default所在的div控制,所以我們可以給ke-container和ke-container-default設定一個寬度和高度,要確保其優先順序最高,所以加!important。

.ke-container.ke-container-default{

width:600px!important;

height:100px!important;

}

kindeditor使用方法,kindeditor怎麼設定長寬度

kindeditor使用方法,kindeditor怎麼設定長寬度

相關問題答案