I try to render a table with as litte text cell padding above and below as possible.
The snippet below shows what I have done so far. However it still contains visible top and bottom "padding" for the cell text.
What other CSS options exist to reduce this white space above the text, so that the text is rendered just below the top line, and the bottom line is drawn just below the text without a gap?
td {
border: 1px solid silver;
line-height: 1;
}
table {
border-collapse: collapse;
}
<!DOCTYPE html>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Table Test</title>
</head>
<body>
<table>
<tr>
<td>
First row
</td>
</tr>
<tr>
<td>
Second row
</td>
</tr>
</table>
</body>
</html>
Many thanks for the answers so far!
In my case, the actual font families and font sizes are unknown, this means that the CSS can't use any fixed values for line height as this has the risk of cut-off characters. So I am looking for a 'canonical' and safe solution.
Ideally, there is just one single CSS setting which causes the 'gap' between text and border to disappear, and works with all fonts families and font sizes (there might be more than one font used in a single cell).
` inside `