Home>

I am making a message reading page with html5 and php5 + postgreSQL.
I've crafted my message so that it can be edited and deleted, but when I bring it up, there are unnecessary spaces above and below it.
I'm trying to omit it with css, but adding a button for editing creates space.
When you remove the button, there is no space.
There are line breaks in the message, so I would like to take advantage of those line breaks if possible.
Please tell me how to eliminate the space above and below.

What i am trying to do
-The textarea tag is used in the "Content" field so that the input of the input person can be displayed as it is.
-I am trying to prevent the characters from going out by adjusting the size of the browser.

What I tried
-I changed the white-space of the style sheet. I'm calm down to pre-line now.
-I put the minimum height in the td tag and thought that it would be adjusted automatically, so I tried using "line-height: 8px", but the characters did not overlap.

Current screen

There is space above and below the frame of Gouda Gou compared to the frame of Nobita Nobi.
There are "Modify" and "Delete" buttons in the "Button" column, but if there is a space above and below, it will look like the bottom row.

Source (excerpt)

<! DOCTYPE html><html><head><meta http-equiv = "Content-Type" content = "text/html;charset = UTF-8"><style type = "text/css">      body {table-layout: fixed;}
        td {white-space: pre-line;}
     </style></head>abridgement<? oho
$date = new DateTime ();
$tstamp = $date->format ('Y-m-d H: i: s');
$user = $_SERVER ["PHP_AUTH_USER"];
$name = $_ POST ["name"];
$number = $_ POST ["number"];
$a1 = "select Recorder name, date and time, content, code, no from msg where receipt number ='". $number. "'Order by date and time DESC";
$a2 = pg_query ($con, $a1);
$a3 = pg_num_rows ($a2);
echo "<table border = 1>\ n";
echo "<tr><td>Recorder name</td><td>Date</td><td>Contents</td><td>Button</td></tr>\ n";
for ($t = 0;$t<$a3;$t ++) {
    echo "<tr>\ n";
        echo "<td>". pg_fetch_result ($a2, $t, 0). "</td>\ n";
        echo "<td>". pg_fetch_result ($a2, $t, 1). "</td>\ n";
        echo "<td>". pg_fetch_result ($a2, $t, 2). "</td>\ n";
        echo "<td style ='vertical-align: middle;'>\ n";
        if (pg_fetch_result ($a2, $t, 3) == $user) {
            echo "<form action ='r_dmemo.htm' method ='POST'>\ n";
            echo "<button type ='submit' name ='rk' value ='rem'>fix</button>\ n";
            echo "<button type ='submit' name ='rk' value ='kesu'>Delete</button>\ n";
            echo "<input type ='hidden' name ='number' value ='". $number. "'>\ N";
            echo "<input type ='hidden' name ='code' value ='". pg_fetch_result ($a2, $t, 3). "'>\ N";echo "<input type ='hidden' name ='no' value =". Pg_fetch_result ($a2, $t, 4). ">\ N";
            echo "</form>\ n";
        }
        echo "</td>\ n";
    echo "</tr>\ n";
}
echo "<tr>\ n";
echo "<td>". $name. "</td>\ n";
echo "<td>". $Tstamp. "</td>\ n";
echo "<form action ='r_dmemo.htm' method ='POST'>\ n";
echo "<td><textarea name ='comments' rows = '3' cols = '40'></textarea>\ n";
echo "<input type ='hidden' name ='number' value ='". $number. "'>\ N";
echo "<input type ='hidden' name ='recorder name' value ='". $name. "'>\ N";
echo "<input type ='hidden' name ='date and time' value ='". $tstamp. "'>\ N";
echo "<input type ='hidden' name ='code' value ='". $user. "'>\ N";
echo "</td>\ n";
echo "<td style ='vertical-align: middle;'>\ n";
echo "<input type ='submit' value ='submit'>\ n ";
echo "</td>\ n";
echo "</form>\ n";
echo "</tr>\ n";
echo "</table>\ n";
?></body></html>
  • Answer # 1

    I changed the white-space of the style sheet. I'm calm down to pre-line now.

    white-space: pre-line;Because is appliedformAll line breaks in are output.
    white-space: pre-line;If you need, apply only to the cells you need.