Monday, April 21, 2014

­ the anti- 

Many of you probably know about &nbsp; the "non-breaking space" -- I think it gets used more often for padding than anything else. Lesser known but possibly more useful is &shy; the "soft-hyphen", like when you have a compound word or what not, maybe something separated by - or /, and you want to say "it's ok to insert a linebreak here, but otherwise keep these parts next to each other." Word is most browsers now support this. (For a while it was in competition with the oddball tag <wbr>, but it seems to have won in this HTML5-ish world.)

2018 UPDATE: I've started using &#x200b; which is ugly as hell but works in IE, for when you want to say "this can break but please don't but a hyphen in there" (I had some data that had no spaces after commas, so I replaced "," with ",&#x200b;")

No comments:

Post a Comment