For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.util.CSS

Utility class for manipulating CSS rules

Defined By

### Methods

Ext.util.CSS
view source
createStyleSheet( String cssText, String id) : StyleSheet
Creates a stylesheet from a text blob of rules. These rules will be wrapped in a STYLE tag and appended to the HEAD o...

Creates a stylesheet from a text blob of rules. These rules will be wrapped in a STYLE tag and appended to the HEAD of the document.

### Parameters

- cssText : String

  The text containing the css rules

- id : String

  An id to add to the stylesheet for later removal

### Returns

- StyleSheet

Ext.util.CSS
view source
getRule( String/Array selector, Boolean refreshCache) : CSSRule

Gets an an individual CSS rule by selector(s)

Gets an an individual CSS rule by selector(s)

### Parameters

- selector : String/Array

  The CSS selector or an array of selectors to try. The first selector that is found is returned.

- refreshCache : Boolean

  true to refresh the internal cache if you have recently updated any rules or added styles dynamically

### Returns

- CSSRule

  The CSS rule or null if one is not found

Ext.util.CSS
view source
getRules( Boolean refreshCache) : Object

Gets all css rules for the document

Gets all css rules for the document

### Parameters

- refreshCache : Boolean

  true to refresh the internal cache

### Returns

- Object

  An object (hash) of rules indexed by selector

Ext.util.CSS
view source
refreshCache : Object

Refresh the rule cache if you have dynamically added stylesheets

Refresh the rule cache if you have dynamically added stylesheets

### Returns

- Object

  An object (hash) of rules indexed by selector

Ext.util.CSS
view source
removeStyleSheet( String id) : void

Removes a style or link tag by id

Removes a style or link tag by id

### Parameters

- id : String

  The id of the tag

### Returns

- void

Ext.util.CSS
view source
swapStyleSheet( String id, String url) : void

Dynamically swaps an existing stylesheet reference for a new one

Dynamically swaps an existing stylesheet reference for a new one

### Parameters

- id : String

  The id of an existing link tag to remove

- url : String

  The href of the new stylesheet to include

### Returns

- void

Ext.util.CSS
view source
updateRule( String/Array selector, String property, String value) : Boolean

Updates a rule property

Updates a rule property

### Parameters

- selector : String/Array

  If it's an array it tries each selector until it finds one. Stops immediately once one is found.

- property : String

  The css property

- value : String

  The new value for the property

### Returns

- Boolean

  true If a rule was found and updated