<p>The difference between <code>.css(width)</code> and <code>.width()</code> is that the latter returns a unit-less pixel value (for example, <code>400</code>) while the former returns a value with units intact (for example, <code>400px</code>). The <code>.width()</code> method is recommended when an element's width needs to be used in a mathematical calculation.</p>
<h4><spanclass="desc">Show various widths. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body.</span></h4>
<spanclass="name">.width( value )</span><spanclass="returns">Returns: <aclass="return"href="http://docs.jquery.com/Types#jQuery">jQuery</a></span>
</h2>
<divclass=" entry-details">
<pclass="desc"><strong>Description: </strong>Set the CSS width of each element in the set of matched elements.</p>
<ulclass="signatures">
<liclass="signature"id="width-value">
<h4class="name">
<spanclass="versionAdded">version added: <ahref="/category/version/1.0/">1.0</a></span>.width( value )</h4>
<pclass="arguement"><strong>value</strong>An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).</p>
<pclass="arguement"><strong>function(index, width)</strong>A function returning the width to set. Receives the index position of the element in the set and the old width as arguments.</p>
</li>
</ul>
<divclass="longdesc">
<p>When calling <code>.width('value')</code>, the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, any valid CSS measurement may be used for the width (such as <code>100px</code>, <code>50%</code>, or <code>auto</code>). Note that in modern browsers, the CSS width property does not include padding, border, or margin.</p>
<p>If no explicit unit was specified (like 'em' or '%') then "px" is concatenated to the value.</p>