<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@csstools/selector-specificity](./selector-specificity.md) &gt; [compare](./selector-specificity.compare.md)

## compare() function

Compare two specificities

**Signature:**

```typescript
export declare function compare(s1: Specificity, s2: Specificity): number;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

s1


</td><td>

[Specificity](./selector-specificity.specificity.md)


</td><td>

The first specificity


</td></tr>
<tr><td>

s2


</td><td>

[Specificity](./selector-specificity.specificity.md)


</td><td>

The second specificity


</td></tr>
</tbody></table>

**Returns:**

number

A value smaller than `0` if `s1` is less specific than `s2`<!-- -->, `0` if `s1` is equally specific as `s2`<!-- -->, a value larger than `0` if `s1` is more specific than `s2`

