Apply styles to DOM elements

In jQuery, you can apply styles to an element using the css() function. The equivalent in JavaScript is the style attribute of the selected element.

For example, refer to the following code snippet to learn how to apply styles to an element through jQuery and vanilla JavaScript:

// Apply styles to elements using jQuery
$(".blog-post").css("border", "2px solid #326ED3");
// Apply styles to elements using vanilla JavaScript
document.querySelector(".blog-post").style.border = "2px solid #326ED3";