首页 > 解决方案 > HTML: Inline block doesn't work for just one table

问题描述

I'm REALLY new to html, and I'm trying to create a html set of tables, I am using display : inline block and it works the way I want, to put some tables next to the others... but when I put just one table it doesnt shows the borders of the table. The code is the following:

        table {
               border: 1px solid black;
               border-collapse:collapse;
               display: inline-block;
              }
        h2.headertekst {
               text-align: center;
               color : white;
               font-family: verdana
               }
<!DOCTYPE html>
<html>
<head>
<body bgcolor="#3377ff">
<h2 class = "headertekst">Mis Pokemons Favoritos</h2>
<table bgcolor="#e52b50">
<tr>
<th rowspan="4">
<img src="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png">
</th>
<td style="color: white">Nombre: Bulbasaur</td>
</tr>
<tr>
<td style="color: white">Peso: 69</td>
</tr>
<tr>
<td style="color: white">Altura: 10</td>
</tr>  
<tr>
<td style="color: white">Expreriencia Base: 64</td>
</tr>   
</table>
</body>
</html>

and the rest is just the information on the cells

标签: htmldisplayccss

解决方案


你为什么要内联?我建议在桌子上使用 float:right


推荐阅读