Page 1 of 1

TinyMCE only reads from </__body> styles

Posted: Tue Sep 06, 2005 4:04 pm
by JQ
Does anyone know why the TinyMCE editor seems to take the body styles and apply them to the text you are editing automatically?

I have a text-align:center in my stylesheet for the body, but the content is in a div with text-align left. TinyMCE seems to just look at the body styles and centers the text I am editing. Also my body background is black, so the background in the editor is black, even though the content is in a div with a red background...

Of course everything is fine on the actual page after it is submitted, but it will confuse my users if everything shows up centered in the editor and ends up right on the actual page.

Any ideas?

Re: TinyMCE only reads from </__body> styles

Posted: Sun Sep 25, 2005 8:26 pm
by seliger
This is a workaround that I am using to get around that issue. The ulmate workaround is to turn off the WYSIWYG editor and make your users use HTML tags. ;-) But sometimes that's not possible... So here it is:

Put your body styles in a different class:

Code: Select all

.body_style {
  background: #000000;
  margin: 0px;
  padding: 0px;
}

Then in your HTML, patch up your body tag like so:

Code: Select all

</__body class="body_style">

That will return the editor's background color to the default white. This doesn't solve the problem of "the background color doesn't match the background of where the content is supposed to go," but if you are using extreme colors for backgrounds that make it impossible to read the text, this is something to consider.

Hope this helps!
Corey