Ash Pettit
Ash Pettit

Reputation: 457

How can I edit text content using strictly only CSS

I'm editing a WordPress site at present. I've been researching this a bit but I can't work out why this isn't working.

The problem is I'm confined to the bounds of CSS editing only. I cannot touch the HTML. Thus I am hoping to edit content via CSS. (I realize this is abnormal).

So far I can across this suggested solution. It did however, not work for me.

Does anyone know a cool trick to edit content via CSS and not HTML, PHP, JavaScript etc...

Suggested code below not working

.comment-reply-title {
display:none !important;
}

.comment-reply-title::after {
content: "New text";
text-indent: 0;
display: block;
line-height: initial;
}

Upvotes: 1

Views: 628

Answers (1)

dippas
dippas

Reputation: 60563

You can use visibility:hidden in div then apply overflow:visible to ::after

font-size:0 is to hide/collapse the extra space left by div

.comment-reply-title {
  visibility: hidden;
  font-size: 0
}
.comment-reply-title::after {
  content: "New text";
  visibility: visible;
  font-size: 16px
}
<div class="comment-reply-title">Old Text</div>

Upvotes: 4

Related Questions