css() in jQuery
This method is used to get the value of a computed style property of the first element in the set of matched elements.
The CSS and DOM formatting of multiple-word properties can be equally interpret in jQuery . eg) "font-size" and "fontSize" are same meaning.
jQuery will convert the number which is passed, to a string and add px to the end of that string.
css() setter automatically take cares of prefixing the property name.
For example, .css( "user-select", "none" ) in Chrome/Safari will use -webkit-user-select, Firefox will use -moz-user-select, and IE10 will use -ms-user-select.
Relative value is a string starting with += or -=, which is used to increment or decrement the value.
For example, if an element's padding-left is 10px, .css( "padding-left", "+=15" ) would result in a total padding-left of 25px.
$(selector).css(propertyName)
- propertyName - A CSS property name.
$(selector).css(propertyName,value)
- propertyName - A CSS property name.
- value - A CSS property value.
$(selector).css(properties)
- properties - Set of CSS property names and values.
$(selector).css(propertyName,function(index,currentValue))
- propertyName - A CSS property name.
- index - Index position of the element in the set.
- currentValue - Old CSS property value.