zengun

weblog

20040809

printing acronyms

While trying to fit a giant title into a two lines area, converting what could be converted to acronyms, I wondered how I could expand said acronyms in the printed version of the page.
I also wondered why Gecko bothered to print a dotted border-bottom on acronyms: after all, on a sheet of paper they aren’t quite hoverable, so the dotted line is just distracting.

So anyway, here’s what one could use to print an acronym:

acronym[title]:after {
	content: "\0000a0(" attr(title) ")";
}
acronym {
	border-bottom: 0;
}

Problem: Typography dictates that only the first instance of an acronym be expanded. To comply, one would have to change acronym[title] to acronym.first[title], and then add class=”first” to the first instance of the acronym.
Half-assed workaround: CSS3 provides a :first-of-type pseudo class that applies to sibling tags. Once it’s implemented in browsers, it could be used to expand the first acronym in each container. That’s a good enough solution if one doesn’t want to pollute markup with extra classes.


4 responses

  1. Avec les compteurs CSS, ça doit être faisable aussi … mais si mes souvenirs sont bons, il n’y a qu’opera qui les supporte relativement bien.

    #1 nicky — 2004/08/09 at 14:28

  2. dotted line is just distracting.

    #2 搬屋2007/08/09 at 5:21

  3. How would you translate into Spanish “Anti-snap baxk roll”? Thank you.

    #3 Dante — 2009/03/22 at 18:31

  4. Anti-snap back roll. Sorry I madea typo in my former message.

    #4 Dante — 2009/03/22 at 18:32

Your words


Required fields:
Are marked by this sign: *
XHTML:
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
On comment spam/irrelevance:
Your comment may be moderated or considered as spam by the leprechauns running this server. If you get a 412 error or a mean message, it may be that they thought it was spam: try wording the comment differently or remind me to put up a contact form so you can warn me about the problem.
Of course, once the leprechauns are done doing their magic, I reserve the right to delete any comment for any reason.