DeanWhitehouse Posted May 4, 2008 Share Posted May 4, 2008 i have a piece of text in a variable(which people can edit) this text needs to be displayed down the page and should stay within the bounderies i set, but it isn't. here are some snippets from my code. $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomise the site."; <p class="welcome"><?php echo"$intro"; ?></p> p.welcome { color:#000; font-size:14px; text-align:center; margin-left:425px; margin-top:40px; width:400px; border:ridge #0000FF; } Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/ Share on other sites More sharing options...
rarebit Posted May 4, 2008 Share Posted May 4, 2008 That works for me? <style type='text/css'> p.welcome { color:#000; font-size:14px; text-align:center; margin-left:425px; margin-top:40px; width:400px; border:ridge #0000FF; } </style> Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532863 Share on other sites More sharing options...
DeanWhitehouse Posted May 4, 2008 Author Share Posted May 4, 2008 this is the site, you can see that it isn't working and what it is doing wrong. http://deanwhitehouse.awardspace.co.uk/home.php with ********* it does what you see on the page, and if i use words like "thisistext" it does work, why is this?? Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532867 Share on other sites More sharing options...
rarebit Posted May 4, 2008 Share Posted May 4, 2008 The css stuff works for me(using Firefox), hmmmm i've just looked at the source to see your DTD, and if you look you have two whole pages in it... i'd have a revamp there... As for the long word (*'s) look at wordwrap Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532878 Share on other sites More sharing options...
DeanWhitehouse Posted May 4, 2008 Author Share Posted May 4, 2008 ok, i tried the wordwrap code, and it doesn't seem to apply wrap to the second line. $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomise the site.TEXTTEXTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT"; $welcome = wordwrap($intro, 60, "<br />\n"); <p class="welcome"><?php echo"$welcome"; ?></p> Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532890 Share on other sites More sharing options...
rarebit Posted May 4, 2008 Share Posted May 4, 2008 This single line: site.TEXTTEXTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT is only 56 chars long, your wrapping at 60! Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532894 Share on other sites More sharing options...
DeanWhitehouse Posted May 4, 2008 Author Share Posted May 4, 2008 yer, that was a mistake, i have now got it at 30 but and still having the same error Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532898 Share on other sites More sharing options...
rarebit Posted May 4, 2008 Share Posted May 4, 2008 mmm, I didn't read the man page... the second example uses 'true' to break long words... $welcome = wordwrap($intro, 60, "<br />\n", true); Quote Link to comment https://forums.phpfreaks.com/topic/104092-solved-how-to-keep-text-within-a-certain-area/#findComment-532901 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.