W3C home > Mailing lists > Public > www-style@w3.org > March 2015

[css-text-decor] not underlining trailing spaces

From: Florian Rivoal <florian@rivoal.net>
Date: Mon, 9 Mar 2015 17:45:30 +0100
Message-Id: <3A25BF98-130D-43F1-A883-90EAC8EDECB5@rivoal.net>
To: www-style list <www-style@w3.org>
If you have "text-decoration: underline;" and "white-space: pre-wrap;" (or pre)
all the (non collapsed) white space is underlined, including the spaces at the end of the line that are followed by a break/wrap point.

http://jsbin.com/bedefu/1/watch?html,css,output

That is what I'd expect based on the spec, but it may not be the ideal behavior in all cases. For instance, word processors / rich text editors don't do this, and if you're making a web based rich text editor using contenteditable and the like, you would want to match.

MS Word, LibreOffice, Apple Page or Apple TextEdit all do the same in this case: underline the spaces between the words, but not those at the end of the line.

We should probably not try to change the default behavior, given that:
- We have interop on the current behavior
- In other contexts, the current behavior may actually be what you want (for example, underlines caused by syntax highlighting in vim matches what we currently do).

However, I do think this would be worth supporting. Adding "trailing-spaces" as a new value to the text-decoration-skip would be ideal for this.

 - Florian
Received on Monday, 9 March 2015 16:45:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC