piersk
03-05-2005, 01:47 PM
Is this possible? It seems there is an IE only option, but not a cross-browser one.
|
Click to See Complete Forum and Search --> : [Resolved] Word wrapping in css piersk 03-05-2005, 01:47 PM Is this possible? It seems there is an IE only option, but not a cross-browser one. dalecosp 03-05-2005, 03:31 PM Whaddya mean exactly? You can do a bit with "float" and "clear" .... piersk 03-05-2005, 03:32 PM Well, at the moment, the text is doing this (http://piersonthe.net). And it shouldn't be goldbug 03-05-2005, 03:39 PM Well, when are you really going to use a string that long with no breaks? (A space or two will cause a wrap) If you feel like forcing a wrap, consider the <wbr /> tag. dalecosp 03-05-2005, 04:38 PM I assume he's talking about ensuring that some [not-so]-friendly blog respondent enters some gobbledygook string that will ruin his site's appearance. I'm just now looking for something on the <wbr /> tag (thanks, gb!) However, there are a number of PHP possibilities in the manual's user notes on strlen and maybe some other similar functions: // courtesy of 'php a+ capcarerre d.t 0rg' function nicetrim ($s) { // limit the length of the given string to $MAX_LENGTH char // If it is more, it keeps the first $MAX_LENGTH-3 characters // and adds "..." // It counts HTML char such as á as 1 char. // $MAX_LENGTH = 22; $str_to_count = html_entity_decode($s); if (strlen($str_to_count) <= $MAX_LENGTH) { return $s; } $s2 = substr($str_to_count, 0, $MAX_LENGTH - 3); $s2 .= "..."; return htmlentities($s2); } I see no reason why you couldn't even insert the ellipsis (or probably a hyphen would be preferred) and a space and return the entire string... Of course, I could be missing Piers' point entirely. HTH, goldbug 03-05-2005, 04:59 PM Originally posted by dalecosp I'm just now looking for something on the <wbr /> tag (thanks, gb!) I should probably add it's not mentioned in any W3C XHTML DTD :( (However, there's no reason it can't exist in your own DTD. IE & Gecko should have no problem with <wbr>) Merve 03-05-2005, 09:43 PM I guess <wbr /> hasn't been implemented in XHTML because word-wrap was supposed to be implemented in CSS, but it isn't yet, so I guess for now all you can do is break up long words with hyphens using PHP, as was previously suggested. Elizabeth 03-05-2005, 10:15 PM Not sure what it's supposed to look like, but it's wrapping fine for me. :confused: Weedpacket 03-05-2005, 10:15 PM Originally posted by Merve word-wrap was supposed to be implemented in CSS, but it isn't yet Well, it is (http://www.w3.org/TR/CSS21/text.html#white-space-prop), but only with regard to whitespace; discretionary word breaks aren't covered yet (http://www.w3.org/TR/2003/CR-css3-text-20030514/#line-breaking). vaaaska 03-06-2005, 03:46 AM Looks fine to me...on Safari 1.2.4... But your spaces need room to breathe...it's really rough on the eyes... Weedpacket 03-06-2005, 06:01 AM Concurrence with the rest of the crew. Can I ***** about the poor description of the problem? :evilgrin: piersk 03-08-2005, 06:56 AM Sorry, I made a little boo boo. Of course (as gb pointed out) there would never be a word that long, so tis unnecessary to have any wrapping PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved. |