1

1 つのメイン テーブルに 2 2 つのテーブルを含む以下の HTML ページがあります。

    <%-- 
    Document   : P2
    Created on : Mar 7, 2013, 1:19:55 PM
    Author     : u0138039
--%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form name="form1" method="post" action="">
          <table width="722">
            <tr>
              <td width="334">
              <table width="255" >
                <tr>
                  <td width="128"><p>PARTS Updated&#13;</p></td>
                  <td width="111"><label for="PARTS_Updated"></label>
                    <select name="PARTS_Updated" id="PARTS_Updated" >
                      <option value=""></option>
                      <option value="N/A">N/A</option>
                    </select></td>
                </tr>
                <tr>
                  <td><p>TSI OK&#13;</p></td>
                  <td><label for="TSI_OK"></label>
                    <select name="TSI_OK" id="TSI_OK">
                      <option value="N/A">N/A</option>
                      <option value="TSI Query">TSI Query</option>
                    </select></td>
                </tr>
                <tr>
                  <td><p>Special Ins OK&#13;</p></td>
                  <td><label for="Special_Ins_OK"></label>
                    <select name="Special_Ins_OK" id="Special_Ins_OK">
                      <option value="N/A">N/A</option>
                      <option value="SI Query">SI Query</option>
                    </select></td>
                </tr>
              </table></td>
              <td width="376"><table width="279" align="center" height="44">
                <tr>
                  <td width="87"><p>Shipment ID&#13;</p></td>
                  <td width="97"><label for="Ship_ID"></label>
                  <input type="text" name="Ship_ID" id="Ship_ID"></td>
                </tr>
              </table></td>
            </tr>
          </table>
        </form>
        <h1>&nbsp;</h1>
    </body>
</html>

以下の部分をコメントアウトするとき

<%-- 
    Document   : P2
    Created on : Mar 7, 2013, 1:19:55 PM
    Author     : u0138039
--%>

必要に応じてテーブルを取得していますが、コメントを外すと、行スペースが変化しています。つまり、増加しています。行スペースを減らす方法を教えてください。上記の部分にコメントしてください。

ありがとう

4

1 に答える 1

0

このコードを確認してください:

<%-- Part 1 (Replace % with ! for HTML comment)
    Document   : P2
    Created on : Mar 7, 2013, 1:19:55 PM
    Author     : u0138039
-->
<!DOCTYPE html>
<%-- Part 2 (Replace % with ! for HTML comment)
   Document   : P2
   Created on : Mar 7, 2013, 1:19:55 PM
   Author     : u0138039
-->

<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
</head>
<body>
    <form name="form1" method="post" action="">
      <table width="722" border=1>
        <tr>
          <td width="334">
          <table width="255"  border=1>
            <tr>
              <td width="128"><p>PARTS Updated&#13;</p></td>
              <td width="111"><label for="PARTS_Updated"></label>
                <select name="PARTS_Updated" id="PARTS_Updated" >
                  <option value=""></option>
                  <option value="N/A">N/A</option>
                </select></td>
            </tr>
            <tr>
              <td><p>TSI OK&#13;</p></td>
              <td><label for="TSI_OK"></label>
                <select name="TSI_OK" id="TSI_OK">
                  <option value="N/A">N/A</option>
                  <option value="TSI Query">TSI Query</option>
                </select></td>
            </tr>
            <tr>
              <td><p>Special Ins OK&#13;</p></td>
              <td><label for="Special_Ins_OK"></label>
                <select name="Special_Ins_OK" id="Special_Ins_OK">
                  <option value="N/A">N/A</option>
                  <option value="SI Query">SI Query</option>
                </select></td>
            </tr>
          </table></td>
          <td width="376"><table width="279" align="center" height="44" border=1>
            <tr>
              <td width="87"><p>Shipment ID&#13;</p></td>
              <td width="97"><label for="Ship_ID"></label>
              <input type="text" name="Ship_ID" id="Ship_ID"></td>
            </tr>
          </table></td>
        </tr>
      </table>
    </form>
    <h1>&nbsp;</h1>
</body>
</html>

ケース 1: 「Part1」と「Part2」にコメントする場合。それで: ここに画像の説明を入力

ケース 2: 「Part1」のコメントを外し、「Part2」をコメントする場合。それで: ここに画像の説明を入力

ケース 3: "Part1" をコメントし、"Part2" をアンコメントする場合。それで: ここに画像の説明を入力

「DOCTYPE html」宣言は、ページがどのバージョンの HTML で記述されているかを Web ブラウザーに指示するためです。

ケース 2 では、最初の行がこの「DOCTYPE html」ではないため、Web ブラウザは html のバージョンを認識できず、残りのタグをフォーマットできません。

ケース 3 では、最初の行がこの「DOCTYPE html」であるため、Web ブラウザは html のバージョンを認識できるため、残りのタグをフォーマットできます。したがって、フォーマットされたテーブルを取得しています。

于 2013-03-07T09:16:03.580 に答える