Skip to content

Commit f573ebf

Browse files
authored
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. Closes gh-1295
1 parent e33934b commit f573ebf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

entries/css.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ $( "div" ).on( "click", function() {
152152
<ul>
153153
<li>setting the element position: <code>top</code>, <code>right</code>, <code>bottom</code>, <code>left</code></li>
154154
<li>setting the element dimensions: <code>width</code>, <code>height</code>, <code>min-width</code>, <code>min-height</code>, <code>max-width</code>, <code>max-height</code></li>
155-
<li><code>padding-related</code>: <code>padding</code>, <code>padding-top</code>, <code>padding-right</code>, <code>padding-bottom</code>, <code>padding-left</code></li>
156-
<li><code>margin</code>-related: <code>margin</code>, <code>margin-top</code>, <code>margin-right</code>, <code>margin-bottom</code>, <code>margin-left</code></li>
157-
<li><code>border</code>-related: <code>border</code>, <code>border-width</code>, <code>border-top</code>, <code>border-top-width</code>, <code>border-right</code>, <code>border-right-width</code>, <code>border-bottom</code>, <code>border-bottom-width</code>, <code>border-left</code>, <code>border-left-width</code></li>
155+
<li>padding-related: <code>padding</code>, <code>padding-top</code>, <code>padding-right</code>, <code>padding-bottom</code>, <code>padding-left</code></li>
156+
<li>margin-related: <code>margin</code>, <code>margin-top</code>, <code>margin-right</code>, <code>margin-bottom</code>, <code>margin-left</code></li>
157+
<li>border-related: <code>border</code>, <code>border-width</code>, <code>border-top</code>, <code>border-top-width</code>, <code>border-right</code>, <code>border-right-width</code>, <code>border-bottom</code>, <code>border-bottom-width</code>, <code>border-left</code>, <code>border-left-width</code></li>
158158
</ul>
159159
<p>When using <code>.css()</code> as a setter, jQuery modifies the element's <code>style</code> property. For example, <code>$( "#mydiv" ).css( "color", "green" )</code> is equivalent to <code>document.getElementById( "mydiv" ).style.color = "green"</code>. Setting the value of a style property to an empty string &#x2014; e.g. <code>$( "#mydiv" ).css( "color", "" )</code> &#x2014; removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's <code>.css()</code> method, or through direct DOM manipulation of the <code>style</code> 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 <code>&lt;style&gt;</code> element. <strong>Warning:</strong> one notable exception is that, for IE 8 and below, removing a shorthand property such as <code>border</code> or <code>background</code> will remove that style entirely from the element, regardless of what is set in a stylesheet or <code>&lt;style&gt;</code> element.</p>
160160
<p><strong>Note:</strong> <code>.css()</code> doesn't support <code>!important</code> declarations. So, the statement <code>$( "p" ).css( "color", "red !important" )</code> does not turn the color of all paragraphs in the page to red as of jQuery 3.6.0. Do not depend on that <em>not working</em>, 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.</p>

0 commit comments

Comments
 (0)