kfir91 Posted January 21, 2011 Share Posted January 21, 2011 hey i have a div <div style="width: 100px;"> testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest </div> the test changed my width why? i want that its line break... i tried display: block; and its no ok Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/ Share on other sites More sharing options...
merylvingien Posted January 21, 2011 Share Posted January 21, 2011 Have you tried adding any spaces between your testestestestestestest... I dont know of any words that long lol supercalifragilisticexpialidocious is about the longest one i can remember... Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1163229 Share on other sites More sharing options...
kfir91 Posted January 21, 2011 Author Share Posted January 21, 2011 u dont understand i have this <td> test test test test test test test test test test </td> the td width is 100px and he write all the "test" in one line... why? and i break line automatic without <br> or div width height etc... white-space didnt help display: block; didnt help Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1163237 Share on other sites More sharing options...
Topshed Posted January 24, 2011 Share Posted January 24, 2011 do you have the width set in your table or your div ??, If they are not fixed and there is room they tend to expand to fit it in div { margin-left: auto; margin-right: auto; width: 1024px; } Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1164187 Share on other sites More sharing options...
raj23 Posted January 24, 2011 Share Posted January 24, 2011 Hi, Just insert a paragraph tag in your div like <div style="width: 100px;"> <p>testtesttesttesttesttesttesttesttest</p><p>testtesttesttesttesttesttesttesttesttesttesttesttesttest</p> </div> and use display:block comment in CSS like this p { display:block; } You can also use h4 tag in place P tag Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1164318 Share on other sites More sharing options...
raknjak Posted January 24, 2011 Share Posted January 24, 2011 nonononono word-wrap: break-word; but does not work in all browsers Where is the data coming from? I presume you're trying to check unusual user input - you could do this server-side, for example in php you have the built-in wordwrap function. Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1164366 Share on other sites More sharing options...
Minimeallolla Posted February 17, 2011 Share Posted February 17, 2011 I had this problem when I was coding my first website. The solution was a code but I've forgotten it now and I cant access my backup files right now sorry just keep looking for codes/scripts. Also if your using a database or mysql some ftp servers can limit the characters. Quote Link to comment https://forums.phpfreaks.com/topic/225198-line-break-in-div-how/#findComment-1175448 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.