可调整大小的表区域PHP

时间:2013-07-27 05:10:18

标签: php html css mysql html-table

我试图一次显示很多结果(比如25),但是我的程序会在区域空间仍然可用的第5条记录周围剪切结果,结果在表格中 动态创建,但似乎该区域没有相应扩展。

<div id="contenido" class="contenido">

 <div id="Tabs">
<ul style="cursor:pointer;">
<li id="li_tab1" onclick="tab('tab1')" >
           <a>&Uacute;ltimas alertas</a>  </li>
    <li id="li_tab2" onclick="tab('tab2')">  <a>otras</a> </li>
</ul>

<div id="Content_Area">

    <div id="tab1">
        <p class="notas">Showing last alerts</p>
        <table>
            <tr>
                <td style="color:blue">Alert</td>
                <td style="color:blue">User</td>
            </tr>
            <?php
                while ( $row = $result->fetch_array() ){

                   echo "<tr><td>".$row['DESCRIPTION']."</td>";
                echo "<td>".$row['EMAIL']."</td>";
                echo "<td>".$row['SUB_SECCION']."</td></tr>";                   
                }
            }
            else
                echo "error on query: ".$conx->error;
            }//else
            ?>
        </table>        
    </div>

    <div id="tab2" style="display: none;"> 
         <!-- We set its display as none because we don’t want to make this
             tab visible by default. The only visible/active tab should 
             be Tab 1 until the visitor clicks on Tab 2. -->
        <p>This is the text for tab 2.</p>
    </div>

    </div> <!-- End of Content_Area Div -->
     </div> <!-- End of Tabs Div -->

     </div>

CSS创建标签,但目前只有第一个有表格,另一个只有一行文字,但表格在此标签div内 archivo css

 .contenido {  
 color: black;/*#333*/
 background-color: #F2F2E6;

 margin: 0px 0px 5px 0px;
 padding: 10px;
 border: 1px solid #ccc;

 width: 75%;/*678px;*/
 height: 480px;

 float: right; 
 display: inline; 
 }

   #Tabs ul {
padding: 0px;
margin: 0px;
margin-left: 10px;
list-style-type: none;
   }

   #Tabs ul li {
display: inline-block;
clear: none;
float: left;
height: 24px;
    }

  #Tabs ul li a {
position: relative;
margin-top: 16px;
display: block;
margin-left: 6px;
line-height: 24px;
padding-left: 10px;
background: #f6f6f6;
z-index: 9999;
border: 1px solid #ccc;
border-bottom: 0px;

/*  make the top left and top right corners of each tab rounded. */
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
/* end of rounded borders */

width: 130px;
color: #000000;
text-decoration: none;
font-weight: bold;
       }

   #Tabs ul li a:hover {
text-decoration: underline;  
color:red;
    }

    #Tabs #Content_Area { 
   /* this is the css class for the content displayed in each tab */
padding: 0 15px;
clear:both;
overflow:hidden;
line-height:19px;
position: relative;
top: 20px;
z-index: 5;
height: 150px;
overflow: hidden;
      }

     p { padding-left: 15px; }

2 个答案:

答案 0 :(得分:1)

问题出在您的CSS中。

height: 150px;中的{p> overflow: hidden;#Tabs #Content_Area可能是因素。

由于overflow: hidden;设置为“隐藏”,因此可能是一个因素。

尝试将其更改为overflow:scroll;overflow:visible;以查看其是否有效,和/或将这些ID的高度更改为更高的数字。

尝试不同的变体。

答案 1 :(得分:0)

我看到两个可能的原因:

  1. 数据库查询仅返回5个结果
  2. DIV不够大,即使桌子最终进入,     比方说,25条记录,前5条只显示,其余的则显示     隐藏在DIV的边界。
  3. 如果您添加更多PHP代码甚至是CSS的{​​{1}},这会有所帮助。

相关问题