Skip to main content
HTML Validation

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

About This CSS Issue

A padding-left declaration has a negative value, and padding can't be less than zero.

Left padding is the space between an element's left border and its content, so CSS only accepts zero or a positive length or percentage for it. A browser drops a padding-left declaration with a negative value, and the element keeps whatever left padding it gets from other rules. On a list, that means the default indentation stays where it was.

To fix the error, change the value to 0 or a positive length. Setting padding-left: 0 removes the indentation a list gets by default. If the content has to move past the left edge of its container, use a negative margin-left, which CSS allows. The padding shorthand and the other side properties follow the same rule, and each one has its own message.

Invalid example

<ul class="links" style="padding-left: -20px;">
<li>First link</li>
<li>Second link</li>
</ul>

Valid example

<ul class="links" style="padding-left: 0;">
<li>First link</li>
<li>Second link</li>
</ul>

Find issues like this automatically

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

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries