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:

http://tympanus.net/Development/CreativeLinkEffects/

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.

[1]
http://stackoverflow.com/questions/7175113/content-attribute-to-inherit-node-value
[2]
http://blog.adrianroselli.com/2012/10/chromatic-type-with-pseudo-elements.html
[3] http://www.dynamicdrive.com/style/csslibrary/item/rollover_text_menu/

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:51:03 UTC