`Index </index.txt>`_

========================
package ``cssutils.css``
========================

:author: $LastChangedBy: cthedot $
:date: $LastChangedDate: 2007-08-08 16:14:03 +0200 (Mi, 08 Aug 2007) $
:version: $LastChangedRevision: 206 $

.. contents::


overview
========
Classes implementing `DOM Level 2 CSS <http://www.w3.org/TR/DOM-Level-2-Style/css.html>`_ and `CSS Module: Namespaces (W3C Working Draft 28 August 2006) <http://www.w3.org/TR/css3-namespace/>`_

:CSSStyleSheet_: Implements ``stylesheets.StyleSheet`` and is the *root* of a stylesheet.
:CSSCharsetRule_: @charset rule
:CSSFontFaceRule_: @font-face rule (from v0.9.5a4)
:CSSImportRule_: @import rule
:CSSMediaRule_: @media rule
:CSSNamespaceRule_: @namespace rule
:CSSPageRule_: @page rule
:CSSStyleRule_: Main Rule with Selectors and ``CSSStyleDeclaration``
:`CSSStyleDeclaration <cssstyledeclaration.txt>`_: Containing a list of Properties
:Property: A single property with name, value and priority information, used for properties in CSSStyleDeclaration and stylesheets.MediaQuery
:`CSSValue <values.txt>`_: A CSS value which might also be a CSSPrimitiveValue or CSSValueList.
:CSSComment: A comment anywhere in the stylesheet. Not in any official spec.

Shared Attributes
=================
.. _cssText:

cssText
    The textual representation of the rule or sheet (cssutils defined this property for CSSStyleSheet_ objects too).
atkeyword
    All @rules have this attribute which holds the literal atkeyword, e.g. ``@im\port``.

CSSStyleSheet
=============
The CSSStyleSheet contains all rules. It consists of the different rules defined above like CSSImportRule_ CSSStyleRule_ etc. It also defines the encoding of the style sheet used for serialization. The encoding might by set with an CSSCharsetRule_ rules or simpler with the encoding_ attribute. The serialized sheet may be obtained from cssText_. All rules are present in cssRules_. Namespace prefixes are available in prefixes_, the actual namespace URIs in the CSSNamespaceRule_ objects (do not rely on prefixes though, see http://www.w3.org/TR/REC-xml-names/ how these work.

Attributes
----------
Also inherits properties from stylesheet.StyleSheet.

.. _cssRules:

cssRules
    of type CSSRuleList, (DOM readonly)
ownerRule
    of type CSSRule, readonly (NOT IMPLEMENTED YET)

.. _encoding:

encoding (cssutils and CSSOM only)
    reflects the encoding of an @charset rule or 'utf-8' (default)
    if set to ``None``.

    Effectively using CSSCharsetRule directly is not needed anymore.

.. _prefixes:

prefixes: set  (cssutils only)
    A set of declared prefixes via @namespace rules. Each
    CSSStyleRule is checked if it uses additional prefixes which are
    not declared. If they do they are "invalidated".

CSSCharsetRule
==============
This rule is not really needed anymore as using  encoding_ of CSSStyleSheet_ is much easier.

CSSNamespaceRule
================
CSSNamespaceRule currently implements http://www.w3.org/TR/2006/WD-css3-namespace-20060828/

namespaceURI
    The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (CSSNamespaceRule.prefix=='') the namespace defined by ``namespaceURI`` is set as the default namespace.
prefix
    The prefix used in the stylesheet for the given CSSNamespaceRule.nsuri. If prefix is empty uri sets the default namespace for the stylesheet.

CSSImportRule
=============
Used to import other CSS style sheets.

.. _href:

href
    The URI where the referenced sheet may be found. May be a string or ``url()`` value.
media
    The media information where the referenced style sheet should be used. See MediaList_ for more details.
stylesheet
    The referenced CSSStyleSheet_. Currently always ``None`` as it is **not implemented**.


CSSMediaRule
============
tbd

CSSFontFaceRule
===============
tbd

CSSPageRule
===========

CSSStyleRule
============
tbd


.. _MediaList: stylesheets.txt