如何做自动换行

I have created a table in PHP but the cells size is not fixed it expends when the input is long. Here is the Code.

echo "<div style=\"overflow-y: scroll; white-space: nowrap; height: 190px;\">
";
        echo "<table cellspacing=\"1\" cellpadding=\"1\" align=\"center\" width=\"100%\" id=\"clients\">
";
        echo "<tr bgcolor=\"2b2d5d\">
";
        echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">&nbsp;</th>
";
        echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Name</th>
";
        echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Address</th>
";
        echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Phone</th>
";
        echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Fax</th>
";

I want to fixed the cells width please need help. Thanks

Just set % widths on the th tags .

<th style="width:20%;">

or you could just set a fixed width on certain columns if you preffered that design.

I would also advice you to move the inline css into a class to save you repeating the same code, and place it in a seperate css stylesheet. Incase your unfamiliar (or anyone who is reading) attach a stylesheet by placing the below in the head of the page:

<link rel="stylesheet" href="default.css">

example class:

.myTableColumn{color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5;width:20%;}

Call it from the column:

<th class="myTableColumn">
<th width="50"></th>

should do. If it doesn't

<th style="max-width: 50px;"></th>