表中用于指定文本框长度的多个div标记



我有一个表,有几个不同的<input type = 'text'>。有些应该是64个字符,有些是7个字符,有些是4个字符。幸运的是,它们都分组在一起,所以我认为最好的方法是为每个部分使用多个div标记。但是,当我尝试在CSS中调整宽度时,没有任何输入改变。到底发生了什么事?我有一个外部CSS。表格代码和CSS代码在

下面另外,我知道64px != 64个字符

编辑:修复工作的html代码。

表:

<?php
    require_once('auth.php');
    //Include database connection details
    require_once('config.php');
  ?>
    <html>
      <head>
        <title>Edit Profile</title>
        <link rel = 'stylesheet' type = 'text/css' href = 'default.css' />
      </head>
    <body>
      <div id = 'sideContainer'>
        <div id = 'navMain'>
          <?php include 'sidebar.html'; ?>
        </div>
      </div>
      <div id = 'content'>
        <?php
          $memberID = $_SESSION['SESS_MEMBER_ID'];
          $query = "SELECT * FROM memberData WHERE member_ID = '$memberID'";
          $result = mysql_query($query);
          while($row = mysql_fetch_assoc($result)){
            $vCode = $row['vCode'];
            $keyID = $row['keyID'];
            $mlYeild = $row['mlYeild'];
            $cycleTime = $row['cycleTime'];
            $veld = $row['veld'];
            $scor = $row['scor'];
            $pyro = $row['pyro'];
            $plag = $row['plag'];
            $omber = $row['omber'];
            $kern = $row['kern'];
            $jas = $row['jas'];
            $hemo = $row['hemo'];
            $gneiss = $row['gneiss'];
            $ochre = $row['ochre'];
            $spod = $row['spod'];
            $crok = $row['crok'];
            $bistot = $row['bistot'];
            $ark = $row['ark'];
            $merc = $row['merc'];
          }
        ?>
        <form id = 'editPlayerInfo' name = 'editPlayerInfo' method = 'post' action = 'editUser-exec.php'>
          <table border = '0'>
            <tr>
              <td colspan = '2'><h2>API stuff</h2></td>
            </tr>
            <tr>
              <td><h3>vCode</h3></td>
              <td><div id = 'vCode'><input type = 'text' name = 'vCode' value = '1234567812345678123456781234567812345678123456781234567812345678'></div></td>
            </tr>
            <tr>
              <td><h3>keyID</h3></td>
              <td><div id = 'keyID'><input name = 'keyID' type = 'text' value = '<?php echo $keyID; ?>'></div>
              </td>
            </tr>
          </table>
          <HR>
          <div id = 'refining'>
            <table>
              <tr>
                <td colspan  = '4'><h2>Mining Laser stuff</h2></td>
              </tr>
              <tr> 
                <td><h3>Mining Laser Yeild</h3></td>
                <td><input name = 'mlYeild' type = 'text' class = 'textfield' id = 'mlYeild' value = '<?php echo $mlYeild; ?>'/></td>
              </tr>
              <tr>
                <td><h3>Cycle Time</h3></td>
                <td><input name = 'cycleTime' type = 'text' class = 'textfield' id = 'cycleTime' value = '<?php echo $cycleTime; ?>'/></td>
              </tr>
            </table>
            <HR>
            <table>
              <tr>
                <td colspan  = '6'><h2>Yeild Specifics</h2></td>
              </tr>
                <td><h3>Veldspar Yeild</h3></td>
                <td><input name = 'veldYeild' type = 'text' class = 'textfield' id = 'veldYeild' value = '<?php echo $veld; ?>'/></td>
                <td><h3>Scordite Yeild</h3></td>
                <td><input name = 'scorYeild' type = 'text' class = 'textfield' id = 'scorYeild' value = '<?php echo $scor; ?>'/></td>
                <td><h3>Pyroxeres Yeild</h3></td>
                <td><input name = 'pyroYeild' type = 'text' class = 'textfield' id = 'pyroYeild' value = '<?php echo $pyro; ?>'/></td>            
              </tr>
              <tr>
                <td><h3>Plagioclase Yeild</h3></td>
                <td><input name = 'plagYeild' type = 'text' class = 'textfield' id = 'plagYeild' value = '<?php echo $plag; ?>'/></td>
                <td><h3>Omber Yeild</h3></td>
                <td><input name = 'omberYeild' type = 'text' class = 'textfield' id = 'omberYeild' value = '<?php echo $omber; ?>'/></td>
                <td><h3>Kernite Yeild</h3></td>
                <td><input name = 'kernYeild' type = 'text' class = 'textfield' id = 'kernYeild' value = '<?php echo $kern; ?>'/></td>
              </tr>
              <tr>
                <td><h3>Jaspet Yeild</h3></td>
                <td><input name = 'jasYeild' type = 'text' class = 'textfield' id = 'jasYeild' value = '<?php echo $jas; ?>'/></td>
                <td><h3>Hemorphite Yeild</h3></td>
                <td><input name = 'hemYeild' type = 'text' class = 'textfield' id = 'hemYeild' value = '<?php echo $hemo; ?>'/></td>
                <td><h3>Gneiss Yeild</h3></td>
                <td><input name = 'gneissYeild' type = 'text' class = 'textfield' id = 'gneissYeild' value = '<?php echo $gneiss; ?>'/></td>          
              </tr>
              <tr>
                <td><h3>Dark ochre Yeild</h3></td>
                <td><input name = 'ochreYeild' type = 'text' class = 'textfield' id = 'ochreYeild' value = '<?php echo $ochre; ?>'/></td>
                <td><h3>Spodumain Yeild</h3></td>
                <td><input name = 'spodYield' type = 'text' class = 'textfield' id = 'spodYield' value = '<?php echo $spod; ?>'/></td>
                <td><h3>Crokite Yeild</h3></td>
                <td><input name = 'crokYeild' type = 'text' class = 'textfield' id = 'crokYeild' value = '<?php echo $crok; ?>'/></td>
              </tr>
              <tr>
                <td><h3>Bistot Yeild</h3></td>
                <td><input name = 'bisYeild' type = 'text' class = 'textfield' id = 'bisYeild' value = '<?php echo $bistot; ?>'/></td>
                <td><h3>Arkonor Yeild</h3></td>
                <td><input name = 'arkYeild' type = 'text' class = 'textfield' id = 'arkYeild' value = '<?php echo $ark; ?>'/></td>
                <td><h3>Mercoxit Yeild</h3></td>
                <td><input name = 'mercYeild' type = 'text' class = 'textfield' id = 'mercYeild' value = '<?php echo $merc; ?>'/></td>
              </tr>
            </table>
            <table align = 'center'>
              <tr>
                <td><input type = 'submit' value = 'Make Changes'></td>
              </tr>
            </table>
          </form>
        </div>
      </div>
    </body>
  </html>
CSS

  #sideContainer {float:left;}
#content {
  float:left;
  padding-left: 5px;
}
#content table {
  border-spacing:10;
  border-collapse:collapse;
}
#content h1 {
  vertical-align:top;
  height:40px; overflow:;
  color: #99CC00;
  margin: 0px 0px 5px;
  padding: 0px 0px 3px;
  font: bold 18px Verdana, Arial, Helvetica, sans-serif;
  border-bottom: 1px dashed #E6E8ED;
}
#content h2 {
  vertical-align:top;
  height:40px; overflow:;
  color: #336622;
  margin: 0px 0px 5px;
  padding: 0px 0px 3px;
  font: bold 24px Verdana, Arial, Helvetica, sans-serif;
  border-bottom: 1px dashed #E6E8ED;
}
#content h3 {
  text-align:bottom;
  height:30px; overflow:;
  color: #99CC00;
  margin: 0px 0px 5px;
  padding: 0px 0px 3px;
  font: bold 18px Verdana, Arial, Helvetica, sans-serif;
  border-bottom: 1px dashed #E6E8ED;
}
#content th {
  font-weight: bold;
  text-align: left;
}
#content a {
  color: #2D3954;
  font-size: 11px;
}
#content a:hover {
  color: #99CC00;
}
#userTable input{
  vertical-align:center;
  margin: 0px 0px 5px;
  padding: 0px 0px 3px;
  background: #ccffaa;
}
#vCode input{
  width: 10px;
}
#keyID input{
  width:100px;
}
#refining input{
  width:50px;
}

#sideTable {
  float:left;
  padding-left: 5px;
}

.err {
  color: #FF9900;
}
#navMain {
  margin-left:25px;
  color:#c3c3c3;
  font-family:Tahoma, Geneva, sans-serif;
}
#navMain h2{
  font-family:Trebuchet MS1, Helvetica, sans-serif;
} /*Change font of the title*/

#navMain ul{
  padding:0;
  margin:0;
  margin-left:25px;
  font-size:15;
  margin-right:20px;
} /*Reset the default padding/margin and set it as required*/

#navMain ul li a{
  font-size:15;
  text-decoration:none;
  color:#c3c3c3;
} /*Change color of link text and remove underline*/

#navMain ul li a:hover{
  color:#e0993e;
} /*Change color of hover text*

sidebar.html

<h2>Categories</h2>
<ul>
<li><a href="editUser-form.php">Edit Personal Info</a></li>
<li><a href="sellToCorp-form.php">Sell to Corp</a></li>
<li><a href="fleet-form.php">Fleet Log Parser</a></li>
<li><a href="theoreticalMining.php">Theoretical Mining</a></li>
<li><a href="theoreticalRefining.php">Theoretical Refining</a></li>
<li><a href="corpMail-form.php">Send Corp Mail - N/A</a></li>
<li><a href="setCorpRate-form.php">Set Corp Rate</a></li>
<li><a href="updateSkillList.php">Update Skills</a></li>
<li><a href="logout.php">logout</a></li>
</ul>

您需要将div移到td标签中。像这样:

<div id='content'>some content is here
  <div id='userTable'>
    <table>
  <tr>
    <th>table header</th>
  </tr>
  <tr>
    <td>
      <div id='chars64'>
        <input type='text' value='1234567812345678123456781234567812345678123456781234567812345678'>
      </div>
    </td>
  </tr>
  <tr>
    <td>
      <div id='chars7'>
        <input type='text' value='1234567'>
      </div>
    </td>
  </tr>
  <tr>
    <td>
      <div id='chars4'>
        <input type='text' value='0.123'>
      </div>
    </td>
  </tr>
</table>

下面是它的jsfiddle: http://jsfiddle.net/TM5Mk/

你也可以参考前面的讨论:

div在表内在表格单元格中放置div

您没有一个有效的HTML表。

你应该有div元素在td元素,然后样式输入。

不能在tr元素前添加<div>

工作小提琴 | | 更新工作小提琴

<div id = 'content'>
    some content is here
    <div id = 'userTable'>
        <table>
            <tr>
                <th>table header</th>
            </tr>
                <tr>
                    <td><div id = 'chars64'><input type = 'text' value = '1234567812345678123456781234567812345678123456781234567812345678'></div></td>
                    <td><div id = 'chars64'><input type = 'text' value = '1234567812345678123456781234567812345678123456781234567812345678'></div></td>
                    <td><div id = 'chars64'><input type = 'text' value = '1234567812345678123456781234567812345678123456781234567812345678'></div></td>
                    <td><div id = 'chars64'><input type = 'text' value = '1234567812345678123456781234567812345678123456781234567812345678'></div></td>
                </tr>
                <tr>
                    <td><div id = 'chars7'><input type = 'text' value = '1234567'</div</td>
                    <td><div id = 'chars7'><input type = 'text' value = '1234567'</div</td>
                    <td><div id = 'chars7'><input type = 'text' value = '1234567'</div</td>
                </tr>
                <tr>
                    <td><div id = 'chars4'><input type = 'text' value = '0.123'></div></td>
                    <td><div id = 'chars4'><input type = 'text' value = '0.123'></div></td>
                    <td><div id = 'chars4'><input type = 'text' value = '0.123'></div></td>
                </tr>
        </table>
    </div>
</div>

我认为这是因为你的HTML是错误的。你可以把<table>元素放到<div>中。只需在<div>中包装输入。不是整个<tr>。这是:

<div id = "content">
    some content is here
    <div id = "userTable">
        <table>
            <tr>
                <th>table header</th>
            </tr>
                <tr>
                    <td> 
                        <div id = "chars64">
                            <input type = "text" value = "1234567812345678123456781234567812345678123456781234567812345678">
                        </div>
                    </td>  
                </tr>
                <tr>
                    <td> 
                        <div id = "chars7">
                            <input type = "text" value = "1234567">
                        </div>
                    </td>
                </tr>
                <tr>    
                    <td>
                        <div id = "chars4">
                            <input type = "text" value = "0.123"> 
                        </div>
                    </td>
                </tr>
        </table>
    </div>
</div>

相关内容

  • 没有找到相关文章

最新更新