我有一个父子组件。父组件html是带有td元素的简单表。我想将子组件定位到td元素的中心。有没有更好的方法来将子组件定位为居中而不在父代的td中添加class ='centered'?
父组件html:
<table>
<tr>
<td class="centered">
<app-courseformat-icon
[formatCode]="course.assignedFormat.formatCode"
[tooltipText]="course.assignedFormat.formatName">
</app-courseformat-icon>
</td>
</tr>
</table>
app-courseformat-icon
是子组件。