1

I have a <p class="hidden"></p> with some text in it. I want to replace all characters in the paragraph with the same character, e.g. a question mark. Note that this is not a viable solution since it requires to specify aprioristically the length of the new string:

.hidden {
  text-indent: -9999px;
  line-height: 0;
}

.hidden::after {
  content: "???";
}

As a way of example:

<p>Just some text!</p>
<p class="hidden">Hello, world!</p>

Should be rendered:

Just some text! 
?????????????
Edgar Derby
  • 2,543
  • 4
  • 29
  • 48

1 Answers1

0

One idea is to build your own font that contain only 1 character (the ? sign) and use it for your text.

I am not familiar with this but you can easily find a lot of tools to do it. I will simply give an example using a strange font to show you the idea:

@font-face {
 font-family: "Strange";
 src: url("https://css-challenges.com/ahem/dugun.regular.otf");
}


p {
  font-size:35px;
}

.hidden {
 font-family: "Strange";
}
<p>some text here</p>
<p class="hidden">some text here</p>
Temani Afif
  • 245,468
  • 26
  • 309
  • 415