jalen Posted May 20, 2009 Share Posted May 20, 2009 Hi Could someone let me know how I could fixed ( limited ) the width and length of <td> and also if someone posted a long paragraph to that data that it will not expand but will have the info posted going on the 2nd line, 3rd line, etc. Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/ Share on other sites More sharing options...
Andy-H Posted May 20, 2009 Share Posted May 20, 2009 <td style="overflow-x: hidden; max-width: 200px; display: block;> <!-- CONTENT --> </td> Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838540 Share on other sites More sharing options...
jalen Posted May 21, 2009 Author Share Posted May 21, 2009 Hi Andy, Could you tell me what that code does? I want my TB, one to be fixed width, (the width is set) no matter what happens. and one to be expand when too much data or fixed with scroll when too much data For example <table> <tr> <td> DATE (set fixed width) </td> <td> people post or information enter here, if too much is inputted, I want it to not expand horizontally but the sentence or lines should go to next row, next row, next row, so expands vertically. Or another option is have it fixed the width and length and when post are too much have a scroll bar. </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838555 Share on other sites More sharing options...
Andy-H Posted May 21, 2009 Share Posted May 21, 2009 http://www.w3schools.com/css/pr_pos_overflow.asp Take a look there, seems I should have used overflow: scroll; =P Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838579 Share on other sites More sharing options...
jalen Posted May 21, 2009 Author Share Posted May 21, 2009 <td width:1500px; height:150px;> this doesn't change the size of the length and width. Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838592 Share on other sites More sharing options...
jalen Posted May 21, 2009 Author Share Posted May 21, 2009 Andy, maybe you don't know my code but this is what it does: <table border =1 align=center width=80%> <tr><td bgcolor =PaleGoldenRod colspan=4> SSSSSSSSSSS<br><br> </td> <tr><td> info 1</td> <td> info2</td> <td> info3</td> <td> info4</td></tr>"; while($info = mysql_fetch_array($data_p)) {//========================================================================= $photo_row =$photo_row+1; if($photo_row==1){//------------------------------------------ $photo_row=0; }//--------------------------------------------------------- print"<tr><td> <div> $info[id]. <font size=2 color=gray> $info[date]</font></div></td>"; echo "<td bgcolor =PaleGoldenRod width=30% > <a href='$dir".$info[trim(name)]."'>".$info[trim(name)]."</a><br> </td> <td> $info[COMMENT] </td> <td> 4 </td> </tr>"; if($photo_row==1){//-------------------------------------------------- $photo_row=0; }//---------------------------------------------------------------- }//=========================================================================== } print"</td></tr></table>"; now how do I set the width limited to info1, and info2 set it's width and height limited and then be able to scroll when too much info is in there. I tried your example and it doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838606 Share on other sites More sharing options...
Axeia Posted May 21, 2009 Share Posted May 21, 2009 <td width:1500px; height:150px;> this doesn't change the size of the length and width. It's because you're making up things. There is 3 ways, <td style="width: 1500px; height: 150px;"></td> <td width=1500 height=150></td> <td width="1500" height="150"></td> You may want to read the html/xhtml/css tutorials on the previously mentioned w3schools. Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-838816 Share on other sites More sharing options...
jalen Posted May 21, 2009 Author Share Posted May 21, 2009 what you mean i made it up? I can't use quote also because I am using it within PHP. for example: <code> print"<table width=80%> <tr> <td> a </td> <td> b </td> <td> c </td> <td> d </td> </tr> </table>"; </code> and I use % in the table data, I can't adjust it to the right width and length that I want. these data, some are fixed width and length some are flexiable when more stuff are put to it. Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-839506 Share on other sites More sharing options...
rv20 Posted May 22, 2009 Share Posted May 22, 2009 There are various ways to ouput a double quote in php, i have always used chr(34) where chr() ouputs a character and 34 is the char code for a double quote so, echo "<td width =" . chr(34) . "100px" . chr(34) . ">" ; wil print <td width = "100px"> and you should be able to fill in the rest. To see what chr() does try for($i=0;$i<256;$i++){ echo chr($i) . "<br>"; } Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-839587 Share on other sites More sharing options...
Axeia Posted May 22, 2009 Share Posted May 22, 2009 You can use quotes perfectly fine in PHP. Again there is more than one option, #1 Escaping them with a backslash (Backslash wont show up in the HTML created by PHP)echo "<td style=\"width: 1500px; height: 150px;\">"; #2 Single quotes inside double quotes or vice versaecho '<td style="width: 1500px; height: 150px;">'; echo "<td style='width: 1500px; height: 150px;'>"; #3 Heredoc syntaxecho <<<EOT <td style='width: 1500px; height: 150px;'> <td style="width: 1500px; height: 150px;"> EOT; You may want to read to documentation about strings, http://nl.php.net/manual/en/language.types.string.php Quote Link to comment https://forums.phpfreaks.com/topic/159003-how-to-fixed-the-width-of-a-and-also/#findComment-839752 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.