Sass nth() Function

You are Here:

Sass nth() Function

The nth() function returns the element of a list at the specified index.

Example

SASS TO CSS CONVERTER
//Check your console @debug nth(10px 20px 30px, 2); // 20px @debug nth(['#fff', '#000', '#8c8c8c'], -1); // #8c8c8c

Syntax

nth($list, $n)

Parameter Value

ValueTypeExplanation
$listRequiredSpecifies a list.
$nRequiredSpecifies the index value in the list.
  • If $n is positive, it counts from the start of $list
  • If $n is negative, it counts from the end of $list
  • Throws an error if there is no element at index $n.

Return Value

ValueExplanation
stringReturns the element of $list at index $n.

Reminder

Hi Developers, we almost covered 99.1% of Sass Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in Sass.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author