:nth-child Zebra Odd/Even Classifier
Classify a one-based child index for the odd and even nth-child selectors.
Description
CSS nth-child indices start at one among sibling elements.
CSS nth-child indices start at one among sibling elements. The odd and even forms support alternating styles such as zebra stripes, with the first element belonging to odd.1
Classify a one-based child index for the odd and even nth-child selectors.
When to use :nth-child Zebra Odd/Even Classifier
Use this tool to classify a one-based child index for the odd and even nth-child selectors.
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 :nth-child Zebra Odd/Even Classifier and understand its results
- 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.
- Enter index using the field table and calculation rules, then run the tool.
- Read matchesOdd, matchesEven. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- 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 field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| index | One-based child index | integer; minimum: 1; maximum: 9007199254740991 | Required |
Enter a positive safe-integer child index. The tool evaluates its parity and returns two complementary booleans. Index 1 is odd and index 2 is even; zero and fractional indices are input errors.
matchesOdd = index mod 2 = 1; matchesEven = index mod 2 = 0 Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| matchesOdd | Matches odd | boolean |
| matchesEven | Matches even | boolean |
{
"input": {
"index": 3
},
"output": {
"matchesOdd": true,
"matchesEven": false
}
} Limitations and assumptions
It does not inspect the DOM or calculate which siblings count under an of-selector filter. Text nodes do not enter CSS element indexing, but the caller must supply the appropriate element position. This is parity classification rather than full selector matching.
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. A successfully returned false flag is an evaluated outcome; its meaning is explained above.
Alternative or Complementary methods
Use :nth-child an+b Pattern Index Generator: List positive child indices up to a supplied bound matching a*n+b for integer n at least zero, supporting negative and zero a; exact integer arithmetic avoids overflow. For a complementary task, use Keyframe Percent Even Split Calculator: Generate evenly spaced keyframe percentages including 0 and 100 from a count of at least two, returning full number precision and limiting materialization to 10,000 offsets.
References
-
:nth-child Zebra Odd/Even Classifier — tool.io
Similar or alternative tools
- :nth-child an+b Pattern Index Generator
List positive child indices up to a supplied bound matching a*n+b for integer n at least zero, supporting negative and zero a; exact integer arithmetic avoids overflow.
- Keyframe Percent Even Split Calculator
Generate evenly spaced keyframe percentages including 0 and 100 from a count of at least two, returning full number precision and limiting materialization to 10,000 offsets.