Title: How do you add custom CSS classes
Last modified: August 21, 2016

---

# How do you add custom CSS classes

 *  [DickRaney](https://wordpress.org/support/users/dickraney/)
 * (@dickraney)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/how-do-you-add-custom-css-classes/)
 * According to TinyMCE documentation, this would create a custom style class for
   Red Text
    `{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},`
 * How would I translate that into entries for the Advanced TinyMCE Settings page
   Option Name and Value fields?
 * [https://wordpress.org/plugins/advanced-tinymce-configuration/](https://wordpress.org/plugins/advanced-tinymce-configuration/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [raytri](https://wordpress.org/support/users/raytri/)
 * (@raytri)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/how-do-you-add-custom-css-classes/#post-4868324)
 * I’d like to second this question. Since upgrading to WordPress 3.9, I can’t get**
   style_formats** to work. I do the following:
 * Option name:
    `style_formats`
 * Value:
 *     ```
       [
       {title: 'Dashed border', classes: 'green-border'}
       ]
       ```
   
 * The “Dashed border” text shows up in the “Formats” dropdown, but it doesn’t apply
   the “green-border” class to selected elements.
 *  [zmalik](https://wordpress.org/support/users/zmalik/)
 * (@zmalik)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-do-you-add-custom-css-classes/#post-4868384)
 * Bear with me the long story but it might help 🙂
 * For me style_formats were working by manually adding related code to my theme
   function file but I wanted tinymce cool features + custom format. Somehow I first
   tried tweaking the main plugin but it didn’t work. Settings got loaded properly
   as per tinymce instructions but they were not taking effect. Then I stumbled 
   upon this utility again the same. I was able to add style_formats via backend
   interface but still not effects. My format dropdown just loaded styles for editor_css.
   No custom defined styles!
 * At the very last moment i just noticed an option in main tinymce advance plugin“
   Load the CSS classes used in editor-style.css and replace the Formats button 
   and sub-menu.” And for me it was check ! Poor bad mistake but it really caused
   me to abandon this gr8 utility. It was straight forward my tinymce advance was
   intentionally not loading style_formats as defined. After disabling this option
   custom formats worked like a charm. It worked via all ways i-e Adding code in
   theme funtion.php , tweaking parent plugin init method or defining it via configuration
   plugin.
 * All hail for TINYMCE creators and TINYMCE WordPress Plugin developer 🙂
 *  [raytri](https://wordpress.org/support/users/raytri/)
 * (@raytri)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-do-you-add-custom-css-classes/#post-4868385)
 * Okay, I figured out what the problem was. When using style_formats, you apparently
   have to specify a selector — there’s no default “apply to everything”.
 * So the following worked for me:
 *     ```
       [
       {title: 'Dashed border', selector:'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,img,table', classes: 'green-border'}
       ]
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How do you add custom CSS classes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-tinymce-configuration.svg)
 * [Advanced TinyMCE Configuration](https://wordpress.org/plugins/advanced-tinymce-configuration/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-tinymce-configuration/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-tinymce-configuration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-tinymce-configuration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-tinymce-configuration/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [raytri](https://wordpress.org/support/users/raytri/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/how-do-you-add-custom-css-classes/#post-4868385)
 * Status: not resolved