Skip to main content
HTML Validation

CSS: “border”: X negative values are not allowed.

About This HTML Issue

Negative values for the CSS border property (specifically border-width) are not valid and will be rejected by browsers.

The border-width property only accepts non-negative length values (like 1px, 0.5em) or keyword values (thin, medium, thick). A negative value such as -1px doesn’t make sense for a border since you can’t have a border with negative thickness.

This error often appears when using inline styles or embedded <style> blocks. It can result from a typo, a calculation error, or a misunderstanding of how border works.

If you’re trying to remove a border, use border: none or border-width: 0 instead of a negative value.

Incorrect Example

<div style="border: -1px solid black;">
  This has an invalid negative border width.
</div>

Correct Example

<!-- Using a valid positive border width -->

<div style="border: 1px solid black;">
  This has a valid border.
</div>

<!-- Removing the border entirely -->

<div style="border: none;">
  This has no border.
</div>

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
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries