Is Text-Indent: -9999Px a Bad Technique for Replacing Text with Images, and What Are The Alternatives

How to indent a few lines in Markdown markup?

Please use hard (non-breaking) spaces

Why use another markup language? (I Agree with @c z above).

One goal of Markdown is to make the documents readable even in a plain text editor.

Same result two approaches

The code

Sample code
    5th position in an really ugly code
    5th position in a clear an readable code
    Again using non-breaking spaces :)

The result

Sample code

    5th position in an really ugly code

    5th position in a clear an readable code

    Again using non-breaking spaces :)

The visual representation of a non-breaking space (or hard space) is usually a normal space " ", however, its Unicode representation is U+00A0.

The Unicode representation of the ordinary space is U+0020 (32 in the ASCII Table).

Thus, text processors may behave differently while the visual representation remains the same.

Insert a hard space

| OS        | Input method                      |
|-----------| ----------------------------------|
| macOS | OPTION+SPACE (ALT+SPACE) |
| Linux | Compose Space Space or AltGr+Space|
| Windows | Alt+0+1+6+0 |

Some text editor use Ctrl+Shift+Space.

Issue

Some text editors can convert hard spaces to common spaces in copying and pasting operations, so be careful.

Web font embedding vs. sifr?

Web fonts are supported in Safari 3.1, the upcoming Firefox 3.5 and the upcoming Opera 10. Internet Explore has supported a (different) format since IE4.

At this point, the biggest problems with the implementation in Safari, Firefox and Opera is that they require you to upload the original font file to your web server. For many fonts, this would constitute a violation of the license you received from the type foundry. Therefore, web fonts right now are not an appropriate solution if the type foundry has not given you permission to use them. However, there are freely licensed fonts available.

This leaves us with roughly three other options: images, Flash, and JavaScript-based solutions. Images are often preferable in that they have minimal impact with regards to browser quirks and performance, however dynamic image generation in, say, PHP often does not look as good as other solutions. You could of course manually create images in Photoshop, but that would usually defeat the purpose.

sIFR uses Flash to render the text, and is quite flexible in that you can select the text, change it dynamically, and have some control over the styling of nested HTML elements. Hoefler & Frere-Jones has given sIFR the OK, provided you pay for a server license and take all possible measures in limiting the sIFR Flash movie to your domain name.

Cufón is a purely JavaScript solution that has implemented its own rendering engine, which is insanely clever. At this point its not as flexible as sIFR, and its legal issues are still unclear.

That said, images, sIFR and Cufón are all hacks, and we need proper web fonts yesterday.

(Disclaimer: I'm the lead developer of sIFR, so I might be somewhat biased.)

two different uses of span: which is the best solution for accessibility?

SPAN is a very generic element, and should be used when no better markup element is suited for the purpose. In your case, the A (anchor) is just what you need, assuming your "call" element is something the user agent should distinguish from pure text. Even if you don't use href, it's still an anchor - just bind it to a mouse event with JavaScript.

Also, using background images here is misplaced. Background images are for backgrounds. In fact, user agents shouldn't even alow clicking on these as part of active user interface (only as a very secondary interaction) If it's a "Call" button you're after, use CSS content property instead. You are right about img though - that's for images that carry page content, not navigation. I.e. buttons, anchors and the like shouldn't use the img tag. You can also use input or button, depending on context (cannot tell from your question).

If you really want to make your pages accessible, you are on the right track, but I really think the following is a better alternative:

 <a class="s1" title="Call the following number">Call</a>

.s1
{
content: url(call.png);
}

You can adjust the size of your anchor that is marked with the s1 class using CSS width and height. I would use an SVG instead though. If your graphic is vector, it is definitely a much better idea. Pixels are for photos and pixel-art :-)

If you want to add some text after your element, you can use CSS :after:

.s1:after
{
content: "Call";
}

Using Text Indent with Text Align

Change your html to this:

<footer>
<div id="footer-container">
<ul id="footerlist">
<hr>
<li><a href="#">Advertising Programs</a></li>
<li><a href="#">Business Solutions</a></li>
<li><a href="#">Privacy & Terms</a></li>
<li><a href="#">+Google</a></li>
<li style='margin-right: 10px'><a href="#">About Google</a></li>
</footer>

Or use this css:

#footerlist li:last-child {
margin-right: 10px;
}

Should I use font-size: 0 for image links?

The important thing here is using your alt tag attribute for SEO, Google recommends it this way.

Having said that there are several css techniques for this. The one i recommend one is using text-indent: -99999em; instead of decresing the font-size.

two different uses of span: which is the best solution for accessibility?

SPAN is a very generic element, and should be used when no better markup element is suited for the purpose. In your case, the A (anchor) is just what you need, assuming your "call" element is something the user agent should distinguish from pure text. Even if you don't use href, it's still an anchor - just bind it to a mouse event with JavaScript.

Also, using background images here is misplaced. Background images are for backgrounds. In fact, user agents shouldn't even alow clicking on these as part of active user interface (only as a very secondary interaction) If it's a "Call" button you're after, use CSS content property instead. You are right about img though - that's for images that carry page content, not navigation. I.e. buttons, anchors and the like shouldn't use the img tag. You can also use input or button, depending on context (cannot tell from your question).

If you really want to make your pages accessible, you are on the right track, but I really think the following is a better alternative:

 <a class="s1" title="Call the following number">Call</a>

.s1
{
content: url(call.png);
}

You can adjust the size of your anchor that is marked with the s1 class using CSS width and height. I would use an SVG instead though. If your graphic is vector, it is definitely a much better idea. Pixels are for photos and pixel-art :-)

If you want to add some text after your element, you can use CSS :after:

.s1:after
{
content: "Call";
}

CSS/HTML: indent whole block of text containing hard returns

It inserts space because you're setting margin to each side of the span (top, left, right, bottom).

Change the style of the span to this:

display:inline-block;margin-left:1em;


Related Topics



Leave a reply



Submit