2014年3月20日

CSS:box model border-box

指定元素大小時會因為padding,border的大小而影響元素實際大小

因為預設box model是content-box

每次只要調整padding或border,整個寬度或高度就全變了~使用起來很麻煩~

現有border-box可以設定,設好寬高是多少就是多少,

不會受到padding,border大小影響,使用起來較直覺 新版瀏覽器有支援,且不影響Jquery

假設所有元素要套用,使用法如下
* {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}

Note:不能與Bootstrap合用, 部份格式會跑掉

2014年3月19日

內部DIV下Float後,外部DIV無法撐開

內部DIV下Float後,外部DIV無法撐開

可以在外部DIV加上class='clearfix'

.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
IE
* html .clearfix {height: 1%;}

.clearfix:after {
    content: "";
    display: table;
    clear: both;
}

.clearfix {
    *zoom: 1;
} 

2014年3月5日

CKEditor 參數設定

config.js

CKEDITOR.editorConfig = function( config )
{
    config.language = 'zh';
    //config.uiColor = '#AADC6E';
    //config.uiColor = '#4895FF';
   
    //config.width=800;
    //config.height=600
    //config.resize_enabled = false;
    config.toolbar = 'general';
    //config.toolbar = 'Full';
   
    config.toolbar_general =
    [
        {name:'line1',items:['Undo','Redo','Copy','Paste','PasteText','PasteFromWord']},
        {name:'line2',items:['Bold','Italic','Underline','Strike','RemoveFormat']},
        {name:'line3',items:['NumberedList','BulletedList','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']},
        {name:'line4',items:['Link','Unlink','Image','Flash','Table','HorizontalRule','PageBreak','Source']},
            '/',
        {name:'line5',items:['Format','Font','FontSize','TextColor','BGColor','Maximize','ShowBlocks','About']},
    ];
    config.toolbar_piconly =
    [
        {name:'line1',items:['Image','Source']},
    ];
   
    /*
    config.toolbar_Full =
    [
        { name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
        { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
        { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
        { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
   
             'HiddenField' ] },
        '/',
        { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
        { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
                                //                        減少縮排 增加縮排
        { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
        { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
        '/',
        { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
        { name: 'colors', items : [ 'TextColor','BGColor' ] },
        { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
    ];*/

};