Re: Using Background-Image to Replace Text (FIR) etc..



Charlie King wrote:

> As I understand it, the use of FIR* to replace heading tags with
> images in visually enabled CSS browsers is now frowned upon on the
> basis that some screen readers will *nor* read back text that is
> marked up by CSS to be invisible or hidden.
>
> So...
>
> If I want to replace headings with images (because my client wants to
> use his specific font for headings where possible), what's the best
> way to do it?
>
> Clearly, I can use img tags with the relevant alt tag, but that loses
> me the importance structure that H tags would give me which, in turn,
> loses hierarchical structural integrity and, more importantly,
> accurate search-engine interpretation.

Not if you mark them up as
<h1><img src="..." alt="MainTitle8"></h1>

> In more detail:
>
> In the code snippet below, 'MainTitle8' and 'SubTitle5' are titles
> that should have the importance of H1 and H2 respectively.
>
> <div id="content-text">
> <p><img src="images/MainTitle8.gif" /></p>
> <p><img src="images/Recette1.jpg" /></p>
> <p>Marc Wery, Professeur de Cuisine. <br />
> Conseiller Culinaire. <br />
> Finaliste du Grand Prix Escoffier 1995. <br />
> 3éme au Trophée Européen 1995.</p>
> <img src="images/SubTitle5.gif" align="left" />
> <p>&nbsp;</p>
> <img src="images/Recette2.jpg" class="imgLeftFloat" />
> ...etc
>
> With FIR, I would do something like...
>
> <div id="content-text">
> <span><h1 class="swap">My main heading</h1></span>

You can't put an <h1> inside a <span>

> ...and CSS like ...
>
> h1.swap {
> height:22px;
> background-repeat:no-repeat;
> }
> h1.swap span {display:none;}

That implies the span is inside the h1 (where it should be instead of
outside like your html says)

> h1#content-text {
> background-image:url("images/MainTitle8.gif");
> }

Your CSS isn't correct for your HTML. The above selector would have to
be "div#content-text h1" instead of "h1#content-text".

> That way, CSS enabled visual browsers would get the image of the
> title, and anything else would get the plain old H1 or H2.

You would have had to set a height to the h1 as well, as I think it
would collapse without content.

> Now, I gather, that's a no-no now, because some screen readers do
> interpret the CSS, and so would not see the hidden H tags.

Display:none is generally not read, so indeed, a no-no.

> How is anyone else doing this?

Like I said:
<h1><img src="image.jpg" alt="replacement of title in image"></h1>

> *(Fahrner Image Replacement - see
> http://www.stopdesign.com/articles/replace_text/ for a far better
> explanation than I can give)

As they say on that page:
"The original technique (FIR) described in the body of this article is
no longer recommended for use, as it makes the hidden text completely
inaccessible for certain screen readers. Instead, see one of the
alternative techniques mentioned at the end of the article under
“Important Notes”."

I don't like the three alternative methods from those 'important
notes' section either though. The less trickery, the better imo.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
.



Relevant Pages

  • Re: why a different tag for SVG images?
    ... |>|>So we have 2 tags and one allows alt content. ... |>changed by tags being present or absent. ... things like images should not be done in HTML tags at all. ... | decorative, they should be inserted as generated content by CSS, then ...
    (comp.infosystems.www.authoring.html)
  • Re: HTML textbook recommendations
    ... text and the images with CSS instead of 4.01 more "right"? ... The one book that I have on html is ... you have a large table with real tabular data, statistics and you decide to make all the table headings white on black and bold text and the data cells black on white. ... Now with 4.01 ands CSS ...
    (alt.html)
  • Using Background-Image to Replace Text (FIR) etc..
    ... marked up by CSS to be invisible or hidden. ... If I want to replace headings with images (because my client wants to ... Clearly, I can use img tags with the relevant alt tag, but that loses ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Centering Image Replacement
    ... but in internet explorer the images appear too far to the right. ... and also many useless, unneeded CSS declarations. ... this bit of CSS shouldn't affect the headings. ... Do you have any ideas now on how to fix things? ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Text Only Page
    ... This content may well have images etc in it. ... regular expression to strip out certain tags is there a more elegant CSS ... then you let the client-side work ...
    (alt.html)