Establecer la altura de la fila de la tabla en CSS
Tengo este código:
<table class="topics" >
<tr>
<td style="white-space: nowrap; padding: 0 5px 0 0; color:#3A5572; font-weight: bold;">Test</td>
<td style="padding: 0 4px 0 0;">1.0</td>
<td>abc</td>
</tr>
<tr>
<td style="white-space: nowrap; padding: 0 5px 0 0; color:#3A5572; font-weight: bold;">test2</td>
<td style="padding: 0 4px 0 0;">1.3</td>
<td>def</td>
</tr>
</table>
Las filas están demasiado separadas. Quiero las líneas más juntas.
Lo que hice fue agregar el siguiente CSS pero no parece cambiar.
.topics tr { height: 14px; }
¿Qué estoy haciendo mal?
6 answers
Prueba esto:
.topics tr { line-height: 14px; }
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-02 15:37:38
Intente establecer el atributo para td
entonces:
.topic td{ height: 14px };
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-18 18:54:39
También puede eliminar un espacio adicional si coloca una instrucción CSS border-collapse: collapse;
en su tabla.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-18 18:59:21
La altura de línea solo funciona cuando es mayor que la altura actual del contenido de <td>
. Por lo tanto, si tiene un icono de 50x50 en la tabla, la altura de la línea tr
no hará que una fila sea menor que 50px (+ relleno).
Dado que ya ha establecido el relleno en 0
debe ser otra cosa,
por ejemplo, un tamaño de fuente grande dentro de td
que es más grande que su 14px.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-14 22:10:43
Si estás usando Bootstrap, mira padding
de tus td
s.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-12 22:53:52
Una vez que necesito fijar la altura de una fila de valores en particular usando CSS en línea como sigue..
<tr><td colspan="4" style="height: 10px;">xxxyyyzzz</td></tr>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-12 09:39:33