This can be useful, for example if you wish to translate the pseudo class content texts (e.g. when using them for tooltips). Currently attr() is supported for content property and almost no browser supports it for other properties, but perhaps they will in the future. Furthermore, the values from attr() are strings, so it really was only meant to be used for content in the first place and can’t be used for units (e.g. font-size) or urls (e.g. content: url() ). Talking of which:

Content: url()This can be used for many types of media (image, sound, video).

Assuming an ES6 codebase, there are several ways to do interpolation in strings.

You could use string concatenation, involving + signs and a string for each piece of the template you’re working on. Using concatenation can quickly get out of hand when dealing with longer templates, not to mention reusability is hard unless you abstract away your template in a small function.

'Hello ' + name + '! It\'s a pleasure to greet you.'

You could use util.format in Node. Here we have placeholders such as %s which describes how the value is to be formatted, but doesn’t say anything about the value that should be placed in that socket in the template. This method