3

I'm trying to build a h1 with a typography splitted in two fonts: stroke font and fill font:

enter image description here

Overlapping both layers I can take control of fill and stroke colors:

enter image description here

The problem is that, in the HTML markup, I need to duplicate contents. Something like this:

<h1>
    <span style="font-family:fill;">Lorem Ipsum</span>
    <span style="font-family:stroke;">Lorem Ipsum</span>
</h1>

I ask for some method for hide one of them in the DOM for robots and blind people devices. Is it possible?

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
aitor
  • 2,281
  • 3
  • 22
  • 44
  • Yes. Delete it and they won't see it. – user5014677 Jun 30 '17 at 10:54
  • 1
    You should be able to achieve what you are after using pseudo elements. Please can you supply a reproducible example (HTML, CSS and font). – Hidden Hobbes Jun 30 '17 at 10:55
  • user5014677: If I do that, I lose control of fill and stroke colors. I need to keep both for render fonts in the screen, but hide one of them for indexing robots. – aitor Jun 30 '17 at 10:57
  • Hidden Hobbes: Yes! of course. Good idea! I will try it. – aitor Jun 30 '17 at 10:59
  • Hidden Hobbes: I am thinking in this method. The H1 content is supplied dinamically by a WordPress CMS template. I can provide dinamically an inline style for the element, but I can't select `:before`or `:after` pseudo elements ouside de stylesheet. And I dont know how provide its contents dinamically in the stylesheet. – aitor Jun 30 '17 at 11:20

1 Answers1

3

aria-hidden would seem to be what you require.

In supporting browsers in conjunction with supporting assistive technology the content is not conveyed to the user via the assistive technology.

So this should work.

<h1>
    <span style="font-family:fill;">Lorem Ipsum</span>
    <span style="font-family:stroke;" aria-hidden="true">Lorem Ipsum</span>
</h1>

See also this answer.

Paulie_D
  • 107,962
  • 13
  • 142
  • 161