Example 1 — Get Outer Width of a Paragraph
Official style: read content + padding + border as a Number.
var p = $("p").first();
console.log("outerWidth: " + p.outerWidth() + "px"); How It Works
- Select. Grab the first paragraph with
$("p").first(). - Measure.
.outerWidth()adds padding and border to content width. - Type. The result is a Number — append
"px"only when printing.

