xxxxxxxxxx
$("selector").css("property", "value");
// Example:
$("div").css("background-color", "red");
xxxxxxxxxx
//revising Ankur's answer
//Syntax:
$(selector).css({property-name:property-value});
//Example:
$('.bodytext').css({'color':'red'});
xxxxxxxxxx
$("selector").css("property", "value");
// Example:
$("div").css("background-color", "red");
xxxxxxxxxx
//create an object and add styles
const styles= {
backgroundColor: "crimson",
fontWeight: "bold",
border: "2px solid lime",
};
$("selector").css(styles);
xxxxxxxxxx
//Checking the CSS properties of an element in jQuery
$(.myElement).css('property-name')
xxxxxxxxxx
// Use jQuery to get the CSS styles of an element by its ID
var styles = $('#elementID').css();
// Print the CSS styles to the console
console.log(styles);