Sass selector-replace() Function

You are Here:

Sass selector-replace() Function

The selector-replace() function returns a copy of $selector with all instances of $original replaced by $replacement. If $selector doesn’t contain $original, returns it as-is.

Note: The $selector, $original, and $replacement selectors may contain placeholder selectors, but not parent selectors.

Example

SASS TO CSS CONVERTER
#{selector-replace("a.disabled", "a", ".link")} { color: black; } #{selector-replace("a.disabled", "h1", "h2")} { color: black; }

Syntax

selector-replace($selector, $original, $replacement)

Parameter Value

ValueTypeExplanation
$selectorRequiredSpecifies the css selector
$originalRequiredSpecifies the original css subselector
$replacementRequiredSpecifies the replacement css subselector

Return Value

ValueExplanation
selectorReturns a copy of $selector with all instances of $original replaced by $replacement.

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