'How to replace text in css?
I was taking a test in fiverr. There I got the following question:
Consider the following code:
body{text-replace: "a" "b" "b" "c"}
What will be the output of the following string if the text replace style is implemented?
1. ndy lives behind cbfe
2. cndy lives cehind ccfe
3. andy lives behind cafe
4. andy lives cehind bafe
Solution 1:[1]
The answer is #2:
“cndy lives cehind ccfe”
The exact CSS sample appears in the spec, linked above, and the example is described as follows (emphasis mine):
The two rules below yield the same result. In the first rule all ‘a’ characters are converted to ‘b’. Subsequently, all ‘b’ characters are converted to ‘c’. In the second rule, all ‘a’ and ‘b’ characters are converted directly to ‘c’.
body { text-replace: "a" "b" "b" "c" } body { text-replace: "a" "c" "b" "c" }
So the processing order goes:
1. andy lives behind cafe
2. bndy lives behind cbfe
3. cndy lives cehind ccfe
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dream180 |
