From 055e70e70081405dc4f40611a681d5a4e3d6417e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Wed, 25 Feb 2026 21:58:44 +0100 Subject: [PATCH] css: Improve formatting of the px-auto-append list When listing CSS properties that still get the `px` suffix auto-appended for numerical values, they are listed in groups that had code blocks applied inconsistently. Removing them increases legibility, so let's do this. --- entries/css.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entries/css.xml b/entries/css.xml index 85a304e8..9d7aa922 100644 --- a/entries/css.xml +++ b/entries/css.xml @@ -152,9 +152,9 @@ $( "div" ).on( "click", function() {

When using .css() as a setter, jQuery modifies the element's style property. For example, $( "#mydiv" ).css( "color", "green" ) is equivalent to document.getElementById( "mydiv" ).style.color = "green". Setting the value of a style property to an empty string — e.g. $( "#mydiv" ).css( "color", "" ) — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's .css() method, or through direct DOM manipulation of the style property. As a consequence, the element's style for that property will be restored to whatever value was applied. So, this method can be used to cancel any style modification you have previously performed. It does not, however, remove a style that has been applied with a CSS rule in a stylesheet or <style> element. Warning: one notable exception is that, for IE 8 and below, removing a shorthand property such as border or background will remove that style entirely from the element, regardless of what is set in a stylesheet or <style> element.

Note: .css() doesn't support !important declarations. So, the statement $( "p" ).css( "color", "red !important" ) does not turn the color of all paragraphs in the page to red as of jQuery 3.6.0. Do not depend on that not working, though, as a future version of jQuery may add support for such declarations. It's strongly advised to use classes instead; otherwise use a jQuery plugin.