Padding 3-Value Shorthand Expansion

Expand three nonnegative pixel paddings, using the second value for both left and right.

Description

A three-value padding shorthand uses top, horizontal sides and bottom in that order.

A three-value padding shorthand uses top, horizontal sides and bottom in that order. The repeated horizontal value is often the key to reading or expanding such a declaration correctly.1

Expand three nonnegative pixel paddings, using the second value for both left and right.

When to use Padding 3-Value Shorthand Expansion

Use this tool to expand three nonnegative pixel paddings, using the second value for both left and right.

Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.

How to use Padding 3-Value Shorthand Expansion and understand its results

  1. Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.
  2. Enter first, second, third using the field table and calculation rules, then run the tool.
  3. Read top, right, bottom, left. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
firstFirst paddingnumber; minimum: 0Required
secondSecond paddingnumber; minimum: 0Required
thirdThird paddingnumber; minimum: 0Required

Enter three nonnegative pixel values. The tool copies them into explicit top, right, bottom and left outputs, assigning the second input to both horizontal sides. Zero values are valid and no rounding or unit conversion is performed.

top = first; right = left = second; bottom = third

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
topTop paddingnumber; minimum: 0
rightRight paddingnumber; minimum: 0
bottomBottom paddingnumber; minimum: 0
leftLeft paddingnumber; minimum: 0
json
{
  "input": {
    "first": 10,
    "second": 20,
    "third": 30
  },
  "output": {
    "top": 10,
    "right": 20,
    "bottom": 30,
    "left": 20
  }
}

Limitations and assumptions

It expands numeric pixels only, without parsing CSS strings, percentages, calc expressions or logical properties. Negative padding is rejected. It does not compute an element's final dimensions or account for box-sizing.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use Border-Width 2-Value Expansion: Expand two nonnegative pixel border widths into vertical and horizontal sides. For a complementary task, use inset All-Four Offsets Shorthand: Expand one to four finite pixel inset values into top, right, bottom, and left offsets.

References

  1. Padding 3-Value Shorthand Expansion — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies