Is there a way to partially hide H2 text using CSS? I have the following code:
HTML:
<div class="twocol-box1 superflex-content-6-12">
<h2 data-content="My - Text&nbsp;<span style="float:right;">May 16, 2022</span>">My - Text <span style="float:right;">May 16, 2022</span></h2>
CSS:
.twocol-box1 h2, .twocol-box2 h2:before {
content: "My - ";
position: absolute;
z-index: 1;
background-color: white;
color: white;
}
.twocol-box1 h2, .twocol-box2 h2 {
position: relative;
z-index: -1;
}
Updated with Fiddle: https://jsfiddle.net/awm2rs7n/
In the example above, I am trying to hide "My -"
Expected Output: Text May 16, 2022
Your advice is appreciated. Thank you.