Hola a todos y gracias por la ayuda.
El problema que tengo es que imprimo una tabla desde php, y cuando imprimo contenido dentro del <tbody> y le doy la propiedad display:block; y overflow-y:auto; me encoge el contenido..y lo que quiero es que quede alineado con las columnas del <thead>.
Si no pongo display: block se ensancha pero no hace scroll, y el scroll es indispensable ya que necesito que me respete la altura. Dejo el código:
Código:
//Función encargada de crear la tabla con los resultados
function CrearTabla($datos){
$bck= "";
$html = '<table id="tablaResultados" style="background: #e7e7e7; text-align:center; height: 540px;" width="100%" cellpadding="5";>';
$html .= '<thead style="display: block;">';
$html .= '<tr style="background:#006699;"><td style="width: 52px; border-top-left-radius: 5px; background: #006699;"><img title="Volver atrás" style="cursor: pointer;" onclick="Refrescar()" src="images/back_white_arrow.png"></td><td colspan="4" style="border-top-right-radius: 3px;"><h3 style="color:#ffffff;">Resultados de búsqueda</h3></td></tr>';
$html .= '<tr style="background:#006699; width:100%; color:#ffffff; font-weight:bold;">';
$html .= '<td style="width:4%;">Descargar</td>';
$html .= '<td style="width:32%;">Numero de certificado</td>';
$html .= '<td style="width:32%;">Fecha de calibracion</td>';
$html .= '<td style="width:32%;">Patrones</td>';
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody style="overflow-y: auto; display: block; height:475px; margin-top:2px; margin-bottom:2px; table-layout:fixed;">';
for ($i = 0; $i < count($datos); $i++) {
if ($i%2 == 0){
$bck = '#ffffff';
}else{
$bck = '#ecf2f6';
}
$html .= '<tr style="background:'.$bck.';">';
$html .= '<td><input type="checkbox" name="cbox'.$i.'" value="seleccioncbox3" id="cbox'.$i.'" onchange="checkboxChanged(this)"></td>';
$html .= '<td>'.$datos[3].'/'.$datos[4].'</td>';
$html .= '<td>'.$datos[41].'</td>';
$html .= '<td>'.$datos[20].'</td>';
$html .= '</tr>';
}
$html .= '</tbody>';
$html .= '<tfoot style="display:table-footer-group;">';
$html .= '<tr style="background:#006699; height:40px;"><td colspan="4" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px;"></td></tr>';
$html .= '</tfoot>';
$html .= '</table>';
return $html;
}
Gracias de nuevo.