2014-04-29 69 views
0

我正在使用我的Vertical_Table function生成表格。當我從div中刪除表格時,我可以調整行和列的尺寸,但是當它位於div內部時,我無法更改它們。任何想法爲什麼?下面是一些jfiddle所以你可以看到我所談論http://jsfiddle.net/6XAHR/無法更改div中表格的列/行高度

CSS代碼

> #Pallate 
{ 
border: 1px solid black; 
position:relative; 
top:40px; 
margin:0 auto; 
width:1200px; 
height:360px; 
background-color: #C8C8C8; 
} 

#Scroll_Table_Border 
{ 
Position:relative; 
top:40px; 
Left:320px; 
border: 1px solid black; 
height:275px; 
max-width: 850px; 
background-color: #C8C8C8; 
} 

#Scroll_Table { 
left:25px; 
top:25px; 
white-space: nowrap; 
Position:Absolute; 
height:225px; 
max-width: 800px; 
width: 100% !important; 
overflow:auto; 
background-color: #C8C8C8; 
} 

#Button_Group_Title 
{ 
Position:Absolute; 
padding-right:5px; 
padding-left:5px; 
background-color: #C8C8C8; 
top:30px; 
Left:35px; 
z-index:2; 
} 
#Scroll_Table_Title 
{ 
Position:Absolute; 
padding-right:5px; 
padding-left:5px; 
background-color: #C8C8C8; 
z-index:2; 
top:30px; 
Left:335px; 
} 


#Button_Group { 
text-align:center; 
padding-top:30px; 
padding-bottom:15px; 
padding-right:25px; 
padding-left:25px; 
border: 1px solid black; 
position:Absolute; 
top:40px; 
left:20px; 
height:230px; 
width:200px; 
vertical-align: middle; 
background-color: #C8C8C8; 
} 

HTML代碼

<div ID = "Pallate" > 
<div ID = "Scroll_Table_Title">Trial Information</div> 
<div ID = "Button_Group_Title">View Results</div> 

<div ID = "Button_Group"> 
    <input type="button" ID = "Paper_Information" onclick="changeContent(this.id)" value="Paper Information" class = "Class_Button"> 
    <input type="button" ID = "Trial_Information" onclick="changeContent(this.id)" value="Trial Setting" class = "Class_Button"> 
    <input type="button" ID = "Results" onclick="changeContent(this.id)" value="Trial Results" class = "Class_Button"> 
    <input type="button" ID = "Control_Law" onclick="changeContent(this.id)" value="Control Algorithm" class = "Class_Button"> 
    <input type="button" ID = "Exercise" onclick="changeContent(this.id)" value="Exercise" class = "Class_Button"> 
    <input type="button" ID = "Actuator" onclick="changeContent(this.id)" value="Pump Properties" class = "Class_Button"> 
    <input type="button" ID = "Sensor" onclick="changeContent(this.id)" value="Glucose Sensor" class = "Class_Button"> 
    <input type="button" ID = "Blood_Glucose_Safety" onclick="changeContent(this.id)" value="Blood Glucose Safety" class = "Class_Button"> 
    <input type="button" ID = "Reference_Glucose" onclick="changeContent(this.id)" value="Reference Measurements" class = "Class_Button"> 
</div> 

PHP代碼

<div ID = "Scroll_Table_Border"> 
     <div ID = "Scroll_Table"> 
      <?php 
      $Columns = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE Table_NAME = \'Control_Law\''; 
      $Columns = sqlsrv_query($dbhandle,$Columns); 
      $Sets = array(sqlsrv_query($dbhandle, 'SELECT * FROM Control_Law WHERE [Paper ID] = ' . $ID)); 

      $i = 0; 
      while ($Row = sqlsrv_fetch_array($Columns)) 
      { 
      $Column_Vector[$i] = $Row[0]; $i++; 
      } 
      $Table_ID = 'Advanced_Table'; 
      $Columns_Vector = array($Column_Vector); 
      Vertical_Table($Columns_Vector,$Sets,'40px','',$Table_ID); 
      ?> 
     </div> 
</div> 

+2

你可以用生成的HTML樣本替換你的PHP,並把整個東西放在jsfiddle.net請。 – Daze

+0

你是否將樣式應用於td元素? CSS真的很挑剔,你必須將任何表格元素應用到表格中的最低節點(​​) –

+0

我剛剛發佈了jfiddle,它具有我的表格,div和其他所有類型的樣式。 – Gaven

回答

0
#Scroll_Table { 
     left:25px; 
     top:25px; 
     white-space: nowrap; //REMOVE THIS 
     Position:Absolute; 
     height:225px; 
     max-width: 800px; 
     width: 100% !important; 
     overflow:auto; 
     background-color: #C8C8C8; 
} 

這將得到它砸下來,那麼你可以設置最大寬度。你現在在那裏的文本的問題是它是全部1個字符串,沒有空格。刪除空格,它會正常下降。希望這可以幫助!