Jump to content

How to fixed the width of a <td> and also


jalen

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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>
  

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>";

 

}

 

 

Link to comment
Share on other sites

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 versa
    echo '<td style="width: 1500px; height: 150px;">';
    echo "<td style='width: 1500px; height: 150px;'>";


  • #3 Heredoc syntax
    echo <<<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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.