W3C home > Mailing lists > Public > www-style@w3.org > October 2013

[css-values] text()

From: Jon Rimmer <jon.rimmer@gmail.com>
Date: Sat, 26 Oct 2013 19:01:45 +0100
Message-ID: <CA+ZDCiC7QE+ZzZGoOccD=pDkA=KFQ3TefpPjd2kNxORdxqRwTw@mail.gmail.com>
To: www-style list <www-style@w3.org>
Hi all,

I'd like to propose a text() function that returns an element's inner-text,
similarly to how attr() returns the value of an attribute.

The use-case for this is creating pseudo-elements that replicate the text
of the element for decorative purposes. For example, see the following list
of link effects:


Most of the effects require the text of the link to be duplicated in a
data-hover attribute so it can be referenced via content: attr(data-hover).
This same technique can found in other places [1][2][3] but is hardly an
ideal practice, given the duplication of content it requires.

[3] http://www.dynamicdrive.com/style/csslibrary/item/rollover_text_menu/

Received on Saturday, 26 October 2013 18:02:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:36 UTC