Skip to main content
HTML Validation

CSS: “padding-right”: X negative values are not allowed.

About This HTML Issue

The CSS property padding-right is used to set the padding space on the right side of an element. According to the CSS specification, padding values must be non-negative, meaning that negative values are not allowed for any of the padding properties.

To resolve the issue, remove the negative value. If you are trying to adjust the layout or spacing, consider using other CSS properties that allow negative values, such as margin. Here’s how you can fix this:

Example Before Fix

.example {
  padding-right: -9px; /* This is incorrect */
}

Example After Fix

.example {
  padding-right: 0; /* Set to zero or a positive value */
  /* If adjustment is needed, consider using margin */
  margin-right: -9px;
}

Explanation:

  • Padding: The padding-right property specifies the space between the content of the element and its border on the right side. This space cannot be negative.
  • Margin: If you’re trying to create an overlapping effect or reduce space externally, using margin-right with a negative value is permissible.

Evaluate the layout requirements and adjust the values appropriately, ensuring you respect the non-negative rule of padding properties.

Last reviewed: April 04, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.