5 ms·
Google, you are a company that makes billions of dolars and I'm nobody to tell you what to do buy maybe you should add this to your CSS: .st, a { d
by jQueryIsAwesome 14y ago
Google, you are a company that makes billions of dolars and I'm nobody to tell you what to do buy maybe you should add this to your CSS:
.st, a {
display: inline-block;
overflow: hidden;
}
Hacker news should do the same thing but with .title, .comment and .comhead
- mostlystatic 14y agoWhat would that do?
- kbrackbill 14y agoA bunch of stuff, but the important thing here is that it clips things above and below each line so things like this can't overlap other lines
- lorettahe 14y agoIt doesn't actually cap the line. It caps the block. Sometimes the block can extend to multiple lines. http://i.imgur.com/698dzMo.png http://i.imgur.com/698dzMo.png After trying with the css suggested here on Google inside Chrome, the problametic characters don't have the top going across too high like originally, but it gets capped on the top of the first line of the paragraph, instead of the line the character is actually at. That said, I'm not sure how to solve this though.
- jQueryIsAwesome 14y agoThe thing is to avoid overlapping with other elements, if they want to ruin their own description/comment so be it. But just for the technical challenge you could do something like this in Javascript to chop every individual special character: string.split("").map(function(a){ return /[a-z0-9\s]/i.test(a) ? a : '<span class="s_char">' + a + '</span>'; }).join(""); And apply the mentioned CSS to the "s_char" class.
- windsurfer 14y agoOh god please no.
- jQueryIsAwesome 14y agoexplain.
- sukuriant 14y agoIt's a huge hammer and a considerably larger webpage footprint just so that a type of character isn't allowed to run amok, something that's not going to happen anyway in the vast majority of cases.
- jQueryIsAwesome 14y agoWe have very different definitions of "huge hammer", in any decent modern browser (Chrome, Firefox, IE9) it takes less than 10ms to apply the mentioned code in 20 texts (using the linked 10 Google results as an example).
- sukuriant 14y agoIt also puts every single special character into its own span. That may negatively affect programs that trust HTML for copy-paste, for example Open Office, Microsoft Word (I think?), some IM clients, some text editors, etc. Doesn't seem worth it in the general case. That said, if those sorts of things bother an individual, they could run that on the page themselves, I suppose, so it's good for that :)
- jQueryIsAwesome 14y agoI don't know OpenOffice but In most programs putting spans around a letter or word does not affect pasting.
- jamesaguilar 14y ago
- kbrackbill 14y agoDoh, you're right. For some reason I had it in my head that the block itself wrapped onto multiple lines but I must have been thinking of something else. It seems like there isn't really any CSS only solution for this without wrapping every character in its own element like jQueryIsAwesome suggested.
- ubershmekel 14y agoSurprisingly it's actually the correct way to render that unicode. It's just a stack of upper diactrics http://jsbin.com/erajer/7/?%E0%B8%81%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89%E0%B9%89 http://jsbin.com/erajer/7/?%E0%B8%81%E0%B9%89%E0%B9%89%E0%B9... as explained in this stackoverflow answer http://stackoverflow.com/questions/10414864/whats-up-with-these-unicode-characters http://stackoverflow.com/questions/10414864/whats-up-with-th...
- jQueryIsAwesome 14y agoTechnically "correct" you mean; if there was an unicode character that filled all the screen with the color black it would not matter if it were technically "correct", usability correct is more important.
- jlarocco 14y agoI disagree. If stacking diacritics are a legitimate part of a language and they change the meaning of words or characters, then it's more important that the content be correct than the "usability." In fact, if a person can't read it or reads it incorrectly because parts of characters are hidden, then it's not very usable. Hypothesizing about a Unicode character that fills the screen with black is a nonsensical straw man, because it makes no sense in "real world" written languages, so there would never be a Unicode character for it.
- jQueryIsAwesome 14y agoFalse; diacritics commonly used in the real-world such as "´¨`" fit inside the same space as the characters, this successive chain of diacritics is never used in real-world texts except for very few obscure cases. Plus the implementation of UTF8 should include the line-height required for the correct displaying of the character if they really believe the displaying of obscure characters is more important than usability.
- 14y ago