On my angular application I have a component that represents simply a html table. The issue I have is that I am unable to reduce cells height. Seems like my css has no impact on the display.
Here headers & catNames var in my component.ts :
catNames : string[] = ["Toto", "Tata", "Titi", "Mama", "Momo"];
headers: string[] = ["Head1", "Head2", "Head3", "Head4", "Head5"];
Here's my component HTML :
<table>
<tr>
<th *ngFor="let header of headers">
{{header}}
</th>
</tr>
<tr>
<td *ngFor="let cat of catNames">
<p>{{cat}}</p>
</td>
</tr>
</table>
Here's my CSS :
table {
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
border-collapse: collapse;
text-align: center;
width: 100%;
font-size: 12pt;
}
th {
border: 1px solid #dddddd;
text-align: center;
padding: 0px;
color: white;
background-color: dodgerblue;
}
td {
display:table-cell;
border: 1px solid #dddddd;
text-align: center;
margin: 0;
padding: 0;
border-spacing: 0;
}
How it is displayed, I want to remove the extra space on top & bottom border of the cell :
Any mistakes in my CSS values?
Remove <P>
tag . Because it will give padding itself. Otherwise give padding in minus. But that's not proper way. So best way is to remove <p>
and use only interpolation value it will be taken as text. Or you can give css directly to <p>
instead of td.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With