0

How can you transform abc to a. b. c. in pure css.

Only if this is not posible how can you achieve this than in angular (typescript).

Babulaas
  • 761
  • 3
  • 13
  • 47
  • 1
    Does this answer your question? [How can I replace text with CSS?](https://stackoverflow.com/questions/7896402/how-can-i-replace-text-with-css) – MaxiGui Oct 08 '20 at 11:56
  • 1
    Short answer. no it is not: [Can we specify custom data attribute values in CSS?](https://stackoverflow.com/questions/36565685/can-we-specify-custom-data-attribute-values-in-css) – MaxiGui Oct 08 '20 at 11:56
  • Do you need a space after the last character? – ruth Oct 08 '20 at 12:08

3 Answers3

3

With typescript it's easy

"abc".split('').join('. ') + "."

you can make a pipe if you need to reuse this function in several places.

With CSS, I don't know how it is possible. I'm curious to know if there is a CSS solution. I suppose no (:

IAfanasov
  • 4,775
  • 3
  • 27
  • 42
1

If you have control over the dom:

You can place a span around each character and then use the ::after pseudo-element to add the periods after each one.

It would look something like:

span::after{
content:"."
}
rguttersohn
  • 464
  • 5
  • 15
0

Unfortunately, you can't write CSS solution to do that in functional way. You can replace that in way that @MaxiGui placed in a comment. If you want to achieve that in typescript (or javascript) you can use this code:

const txt = 'abc';
const transformedTxt = `${txt.split('').join('. ')}.`;
Michał Tkaczyk
  • 732
  • 5
  • 18