Html Csshooks
# jQuery jQuery.cssHooks Method
[ jQuery HTML/CSS Methods](#)
## Example
Define a new css hook
```javascript
$(function($){
//First check if the jQuery version supports cssHooks
if(!$.cssHooks){
//If not supported, output error reminder
throw(new Error("This feature requires jQuery version 1.4.3 or higher"));
}
// Wrap in DOM document ready event, write cssHooks at this time to avoid the cssHooks being overwritten elsewhere
$(function(){
$.cssHooks.height = {
get: function(elem, computed, extra){
// Handle getting this CSS property
},
set: function(elem, value){
// Handle setting CSS property
alert('Execution processing');
}
};
$('body').css('height','100%');
});
})(jQuery)
[Try it Β»](#)
* * *
## Definition and Usage
$.cssHooks provides a way to get and set specific CSS values by defining functions.
**Note:** 1. Its purpose is to standardize CSS property names or create custom properties.
2. For example, some Webkit-based browsers need the -webkit-border-radius property to set an element's border-radius, while earlier Firefox versions use the -moz-border-radius property. A CSS hook can standardize these prefixed properties, allowing .css() to accept a single, standard property name (border-radius, or using DOM property syntax, borderRadius).
* * *
## Syntax
_$_.cssHooks
* * *

## More Examples
(#)
Before standardizing vendor-specific CSS properties, first determine whether the browser supports the standard property or the variant with the browser vendor prefix.
(#)
Define a complete css hook.
* * *
YouTip