php_begins Posted August 3, 2011 Share Posted August 3, 2011 Hi.I have need to insert a line break after specific sequence of characters.. For example consider the following username, LONGLONGUSERNAME... I need a line break after 12 characters or till a specific width. Quote Link to comment https://forums.phpfreaks.com/topic/243730-line-break-after-specific-no-of-characters/ Share on other sites More sharing options...
Maq Posted August 3, 2011 Share Posted August 3, 2011 If you're referring to a user name, like the ones here that PHPF's uses SMF, then wouldn't you use CSS? Set the width and the lines would automatically wrap. Quote Link to comment https://forums.phpfreaks.com/topic/243730-line-break-after-specific-no-of-characters/#findComment-1251440 Share on other sites More sharing options...
php_begins Posted August 3, 2011 Author Share Posted August 3, 2011 I tried that and it didnt work.. In CSS the width works only when you encounter a whitespace Quote Link to comment https://forums.phpfreaks.com/topic/243730-line-break-after-specific-no-of-characters/#findComment-1251447 Share on other sites More sharing options...
voip03 Posted August 3, 2011 Share Posted August 3, 2011 http://php.net/manual/en/function.wordwrap.php http://php.net/manual/en/function.split.php Quote Link to comment https://forums.phpfreaks.com/topic/243730-line-break-after-specific-no-of-characters/#findComment-1251460 Share on other sites More sharing options...
php_begins Posted August 3, 2011 Author Share Posted August 3, 2011 thanks..i actually achieved it with css by using word-wrap:break-word; Quote Link to comment https://forums.phpfreaks.com/topic/243730-line-break-after-specific-no-of-characters/#findComment-1251500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.