Sass index() Function

Last Updated:

Sass index() Function

The index() function returns the index of a value in a list.

Example

SASS TO CSS CONVERTER
//Check your console @debug index(1px solid red, 1px); // 1 @debug index(1px solid red, solid); // 2 @debug index(1px solid red, dashed); // nothing

Syntax

index($list, $value)

Parameter Value

ValueTypeExplanation
$list Required Specifies a list.
$value Required Specifies the value to be searched.
  • If $value doesn’t appear in $list, this returns null.
  • If $value appears multiple times in $list, this returns the index of its first appearance.

Return Value

ValueExplanation
Number Returns the index of $value in $list.

Share this Page

Meet the Author