addCSSText

Availability: >= 3.0

Type: Object Method

Description: Can be used to style the appearance of content in the editor.

Syntax:

$editor->addCSSText string $css );

Parameters:
The single paramater should be a string of CSS rules like what you would use in a stylesheet or within a <style> tag. 

You can use this function to give content in the editor the same default appearance as content on your website. 

If you are editing a complete HTML document that specifies stylesheets or style rules in it's head then you may not need to use this function. This function is intended for when editing a snippet of HTML code that contains no style information.

Rules specified using this function will override rules in stylesheets added with the addStylesheet function.

This function can be called multiple times with each call appending more style data. 

Example:

Imagine that you have added your site's stylesheet to the editor using the addStylesheet function. If you are editing a snippet of HTML code this could cause propblems because your site's stylesheet might give the document body a background image or color that is significantly different to the portion of the page design where content goes. Since when editing a snippet the content is in the document body this can give the content in the editor the wrong appearance. You can use this function to override your stylesheet's default body rules so that content in the editor appears as it would within the content area of your web site's design.

Example:

// add your site's stylesheet using the addStylesheet method:
$editor->addStylesheet('url/of/stylesheet.css');

// Override some of the rules in the above stylesheet:
$editor->addCSSText('body {
    text-align: left;
    background-color: #ffffff;
    background-image: none;
    color: #000000;
    font-size: 13px;
    border-width: 0px;
    margin: 10px;
    padding: 0px;
}'
);


This online documentation specifically covers version 3.0 and above, developers using earlier versions should refer to their PDF or MS-Word manual that was included in the product download.

WysiwygPro.com