jQuery Intro

jQuery Intro Quiz

jQuery Intro Exercise

jQuery Basic

jQuery Basic Quiz

jQuery Basic Exercise

jQuery Advance

jQuery Advance Quiz

jQuery Advance Exercise

jQuery Selectors

jQuery Effects

jQuery Events

jQuery Methods and Properties

jQuery Traversing

jQuery CSS and HTML Methods

css() method in jQuery

css() Method



The css() method can be used to get and set CSS property values. its syntax is:-


To set multiple CSS properties, the css() method uses JSON syntax.Its syntax is:-





  1. Syntax for returning value of CSS property is:- $(selector).css(property)
  2. Syntax for setting value of CSS property is:- $(selector).css(property,value)
  3. Syntax for settings multiple properties and values is:- $(selector).css({property:value, property:value, ...})
  4. Sntax for setting property and value with function is:- $(selector).css(property,function(index,currentvalue))


Further Explanation:-


Parameter Description
property Specifies the CSS property name.
value Specifies the value of the CSS property.
function(index,currentvalue) Specifies a function that returns the new value for the CSS property
  • index - Returns the index position of the element in the set
  • currentvalue - Returns the current value of the CSS property

Code Explanation

All Tutorials related to jQuery Basic

All Sections related to jQuery