Jquery

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

jQuery css() Method

jQuery css() Method

 

 

The css() method is used to set or return one or more style properties for the selected elements.

 

Syntax:-

 

  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 CSS and HTML Methods

All Sections related to Jquery