Search code examples
jquerytinymcewysiwyg

How to change default font size in tinymce?


I am using jquery tinymce editor. Default font size is 10. I like to change that default font size. How can i do that,


Solution

  • You need to use the content_css setting of tinymce to set a custom css file of your own (make sure this setting points to a valid location of a css file). This file will be inserted in the editor iframes head after all other css settings(files from the core) are inserted there when initialising tinymce - thus all settings you place in your file will overwrite the settings made before (by tinymce).

    Example: Setting the default font-size to 11px. Content of a custom css file (i named it content.css in my installation):

    body {
        font-family: Verdana,Arial,Helvetica,sans-serif;
        font-size: 11px;
    }
    

    How to use this setting:

    tinyMCE.init({
     ...
     // you do not need to include it yourself, tinymce will do this for you, 
     // but you will need to give tinymce the location of your css file
     content_css : "http://www.myserver.com/css/content.css", 
         ...
    });