4 APEX_CSS

The APEX_CSS package provides utility functions for adding CSS styles to HTTP output. This package is usually used for plug-in development.

Topics:


ADD Procedure

This procedure adds a CSS style snippet that is included inline in the HTML output. This procedure can be used to add new CSS style declarations.

Syntax

APEX_CSS.ADD (
    p_css          IN    VARCHAR2,
    p_key          IN    VARCHAR2 DEFAULT NULL);

Parameters

Table 4-1 describes the parameters available in the ADD procedure.

Table 4-1 ADD Parameters

Parameter Description

p_css

The CSS style snippet. For example, #test {color:#fff}

p_key

Identifier for the style snippet. If specified and a style snippet with the same name has already been added the new style snippet will be ignored.


Example

Adds an inline CSS definition for the class autocomplete into the HTML page. The key autocomplete_widget prevents the definition from being included another time if the apex_css.add is called another time.

apex_css.add (
    p_css => '.autocomplete { color:#ffffff }',
    p_key => 'autocomplete_widget' );

ADD_FILE Procedure

This procedure adds the style tag to load a CSS library. If a library has already been added, it will not be added a second time.

Syntax

APEX_CSS.ADD_FILE (
    p_name           IN    VARCHAR2,
    p_directory      IN    VARCHAR2 DEFAULT WWV_FLOW.G_IMAGE_PREFIX||'css/',
    p_version        IN    VARCHAR2 DEFAULT C_APEX_VERSION,
    p_skip_extension IN    BOOLEAN DEFAULT FALSE);

Parameters

Table 4-2 describes the parameters available in the ADD_FILE procedure.

Table 4-2 ADD_FILE Parameters

Parameter Description

p_name

Name of the CSS file.

p_directory

Begin of the URL where the CSS file should be read from. If you use this function for a plug-in you should set this parameter to p_plugin.file_prefix.

p_version

Identifier of the version of the CSS file. The version will be added to the CSS filename. In most cases you should set NULL as value.

p_skip_extension

The function automatically adds ".css" to the CSS filename. If this parameter is set to FALSE this will not be done.


Example

Adds the CSS file jquery.autocomplete.css in the directory specified by p_plugin.image_prefix to the HTML output of the page and makes sure that it will only be included once if apex_css.add_file is called multiple times with that name.

apex_css.add_file (
    p_name => 'jquery.autocomplete',
    p_dictionary => p_plugin.image_prefix,
    p_version => null );