Style TinyMCE's editing area and preserve that styling outside the editor

In TinyMCE's classic mode, the editable document lives inside an iframe. Use content_css to load its stylesheet or content_style for a short editing-area rule. A host-page selector does not cross into that iframe, and TinyMCE does not save content_style rules as part of the edited HTML. The page that later displays the saved content needs its own matching styles.

A common example is a notice heading that appears teal while being edited but becomes black on the published page. Compare the saved markup with both pages' stylesheets before changing the save code. The heading text may have saved correctly while its appearance depended on CSS loaded only in the editor.

Identify which document owns the style

Assume TinyMCE has already been installed and loaded in your application. For a classic editor on #notice, configure the content stylesheet at initialization:

tinymce.init({
  selector: '#notice',
  content_css: '/styles/notice-content.css',
  content_style: 'body { margin: 1rem; }'
});

In notice-content.css, put the document rules:

.notice-title {
  color: #16656b;
  font-size: 1.5rem;
  line-height: 1.25;
}

The saved document might contain:

<h2 class="notice-title">Collect equipment before 4 p.m.</h2>
<p>The collection desk closes at 4:15 p.m.</p>

The class identifies what to style. It does not carry the stylesheet's contents. TinyMCE's content CSS options explain the classic iframe context and the distinction between these configuration values and saved content.

Keep editor UI styling separate: changing the toolbar's skin or a host-page button rule does not supply the document heading's CSS.

Give the receiving page the same content rules

Load the corresponding stylesheet on the page that renders the saved notice:

<link rel="stylesheet" href="/styles/notice-content.css">
<article class="notice-body">
  <!-- Render the application's approved, sanitized notice HTML here. -->
</article>

For this fixture, the actual saved h2.notice-title belongs inside that article. Use the application's normal safe rendering path; CSS configuration does not make submitted HTML trustworthy.

If the stylesheet also contains generic body or p rules, review their effect on the receiving page. An editor iframe contains one document; a website may contain navigation, comments, and several articles. Scope publication rules where needed instead of copying broad selectors into an unrelated layout.

TinyMCE separately documents CSS for content displayed outside the editor. Its provided content rules may help with editor-generated structures, but your own notice-specific class still needs the stylesheet that defines it.

Trace the missing style in the browser

Check the same original heading in these locations:

Location Expected observation for the fixture
Saved HTML Contains the intended heading text and notice-title class
Classic editor iframe Loads the configured content stylesheet successfully
Receiving page Loads its content stylesheet and matches .notice-title
Computed style on the heading Uses the intended color and size after the cascade

If the class is absent in the saved HTML, inspect the editor's allowed formats and the application's filtering path. If the class is present but the stylesheet request fails, fix that URL. If the rule loads but loses in the cascade, inspect the winning selector. These are different corrections, even though each can produce a black heading.

For a stale textarea or payload, use the separate TinyMCE content extraction guide; styling the iframe will not synchronize form data.

Check inline mode before copying the configuration

An inline editor uses the host document rather than a classic content iframe. TinyMCE's current inline-mode instructions recommend styling the host page directly and scoping rules to the editable element. Match your installed version and editing mode before applying a classic-mode fix.

Finish by opening the saved notice outside TinyMCE at a narrow width. Confirm that the actual heading and the collection deadline remain readable together. A matching editing preview is useful only when the recipient's page receives the necessary markup and styles too.

Keep reading