Forum   Search   Register   Log in SUPERJER FORUM
 

CSS Or HTML Linebreaks IN Words

Pages: [1]
Programming Help
molkman
Owner of George Washington's Prototype Mittens

Marine Warfare Corporal
Find the Hole Participation Medal
Find the Hole II Participation Medal
Tasty Br�twurst Medal
2005 May 2 • 1996
404 ₧
Y'know, normally when displaying a text on a webpage that is longer than a line, line breaks are added between words. However, I'd like them to be in words, even without dashes.

So neither

code
Blabitty
blabitty bla bla


nor

code
Blabitty bla-
bitty bla bla


But:

code
Blabitty bla
bitty bla bla


Is that possibleeeeeee?
    (Edited 2010 May 27 at 11:39)     2010 May 27 at 11:39
the_cloud_system
polly pushy pants

2008 Aug 1 • 2788
-6 ₧
molkman said:
Y'know, normally when displaying a text on a webpage that is longer than a line, line breaks are added between words. However, I'd like them to be in words, even without dashes.

So neither

code
<{Blabitty}>
blabitty bla bla


nor

code
Blabitty bla-
bitty bla bla


But:

code
Blabitty bla
bitty bla bla


Is that possibleeeeeee?

moo moo moo, moo.
    2010 May 27 at 13:34
SRAW
Rocket Man

2007 Nov 6 • 2069
601 ₧
BLAH
Free Steam Games
    2010 May 27 at 18:50
superjer
superjer

2005 Mar 20 • 3742
I don't think so. Unless there is some crazy CSS option for that I'm unaware of.

You'll need to do that server-side if you can.

Or javascript I guess.
    2010 May 27 at 20:51
molkman
Owner of George Washington's Prototype Mittens

Marine Warfare Corporal
Find the Hole Participation Medal
Find the Hole II Participation Medal
Tasty Br�twurst Medal
2005 May 2 • 1996
404 ₧
Okay, but server-side would change it on the whole site, right? I just want it in certain places.
    2010 May 28 at 09:47
protobuf
The artist formerly known as RibsRizeRainbmo

2010 Apr 15 • 14
The following CSS3 properties may work, but I don't think they're supported in most browsers.

text-wrap: unrestricted;
word-wrap: break-word;
    2010 May 28 at 10:08
superjer
superjer

2005 Mar 20 • 3742
molkman said:
Okay, but server-side would change it on the whole site, right? I just want it in certain places.

Server-side you can choose where to modify the content like that. For example if you are running PHP:
php code

<?php
if(/* wrap $content HARD! */)
{
echo
preg_replace( "~.{70}~", "\\0<br>", $content );
}
else
{
echo
$content;
}
?>


That will insert a <br> every 70 characters depending on what you put for the if's condition.
    2010 May 28 at 15:49
superjer
superjer

2005 Mar 20 • 3742
protobuf said:
text-wrap: unrestricted;
word-wrap: break-word;


Well let's try it:
text-wrap: unrestricted;
Here's some test content for wrapping and smashing to little bits of putrid ectoplasmicalmatterbits. Your rotten hamlion spawn is heavier than a wet sack of concrete bananas!
word-wrap: break-word;
Here's some test content for wrapping and smashing to little bits of putrid ectoplasmicalmatterbits. Your rotten hamlion spawn is heavier than a wet sack of concrete bananas!
    (Edited 2010 May 28 at 15:55)     2010 May 28 at 15:54
the_cloud_system
polly pushy pants

2008 Aug 1 • 2788
-6 ₧
superjer: breaking forum physics
moo moo moo, moo.
    2010 May 28 at 17:31
molkman
Owner of George Washington's Prototype Mittens

Marine Warfare Corporal
Find the Hole Participation Medal
Find the Hole II Participation Medal
Tasty Br�twurst Medal
2005 May 2 • 1996
404 ₧
Cool.

But is it like, working sometimes? "Ecoplasmical" is in a new line.

Update: Looks like it still "obeys" certain "break points" or something.
    (Edited 2010 May 29 at 03:34)     2010 May 29 at 03:20
superjer
superjer

2005 Mar 20 • 3742
Looks to me like word-wrap: break-word; does just what you want on Chrome. I don't know about other browsers.
    2010 May 29 at 12:18
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
I <3 Chrome
    2010 May 29 at 12:20
molkman
Owner of George Washington's Prototype Mittens

Marine Warfare Corporal
Find the Hole Participation Medal
Find the Hole II Participation Medal
Tasty Br�twurst Medal
2005 May 2 • 1996
404 ₧
Hm, my Chrome doesn't. Apparently it still only breaks words at "logical" points and not smashing everything like a crazy viking.
    2010 May 29 at 13:55

Pages: [1]
Forum and design copyright © 2008-2010 SuperJer.com