Align table cell vertically with bootstrap

0

Good morning,

I want to vertically align the text of a table that is being 'printed' by means of a .php by ajax, I have tried to put the attribute to the td tags with:

valign="center" (I read that it no longer works in HTML5, therefore it is assumed that that's why it did not work)

I tried to put the bootstrap class (as I read in link )

class="align-middle" class="align-text-middle"

I tried with css

td { vertical-align: center: }

and also

td {   vertical-align: middle; }

Nothing works, what if it serves is to put the attribute to the td as align="center" that does it horizontally, currently the code I have it as I leave it down after making a query mySql, I wonder if it is not working Why does the table come from a php and is not reflected as such in the .html, that has to do?

<?php
while($row=mysqli_fetch_array($result))
{
    echo '<tr>';
    echo '<td align="center">'.$row['id'] . '</td>';
    echo '<td align="center">'.$row['tipo_solicitud'] . '</td>';
    echo '<td align="center">'.$row['nombre'] . '</td>';
    echo '<td align="center">'.$row['celular'] . '</td>';
    echo '<td align="center">'.$row['direccion'] . '</td>';
    echo '<td align="center">'.$row['email'] . '</td>';
    echo '<td align="center">'.$row['comentarios'].'</td>';
    //se pone // para indicar que es una ruta nueva, si no toma la carpeta actual y concatena con la ruta en MySql
    echo '<td align="center"><a href="//'.$row['ruta_foto1'].'" target="_blank">Ver foto1</a></td>';
    echo '<td align="center"><a href="//'.$row['ruta_foto2'].'" target="_blank">Ver foto2</a></td>';
    echo '<td align="center" bgcolor="#dd425c">' . $row['estado'] . '</td>';
    echo '<td align="center"><button id="'.$row['id'].'" onclick="eliminar_solicitud_revision_tecnica_estado_solicitado(this)" class="btn btn-danger">Eliminar solicitud</button></td>';
    echo '<td align="center"><button id="'.$row['id'].'" onclick="confirmar_visita(this)" class="btn btn-default">Confirmar visita</button></td>';
    echo '</tr>';
}
?>
    
asked by Gabriel Uribe Gomez 01.06.2018 в 20:59
source

1 answer

0

I consider that you respected the structure and that is what is inside of a no?.

The "align-middle" class should suffice. How strange that he is not taking it. Did you try to set a fixed height? for example: "height: 200px;"

In case you want to do it directly with css:

"vertical-align: center;" It will not work if I'm not mistaken. but if you should take it with: "vertical-align: middle;".

Play with the height of the cell and we can see in more detail.

In the case that you do not walk with these things happens as is the final html (not only the php part but how it is laid out).

Greetings!

    
answered by 01.06.2018 в 23:31