表格列中的HTML文本赢得';t中心对齐(弹簧)
我试图在表格中心的列中创建文本,但即使在更改HTML和CSS之后,它似乎也不起作用。我使用spring作为框架。HTML如下所示:表格列中的HTML文本赢得';t中心对齐(弹簧),html,css,spring,html-table,Html,Css,Spring,Html Table,我试图在表格中心的列中创建文本,但即使在更改HTML和CSS之后,它似乎也不起作用。我使用spring作为框架。HTML如下所示: <form> <table class="box-element" th:if="${ not#lists.isEmpty(kitchenRecipes)}"> <div class="header">Available meal
<form>
<table class="box-element" th:if="${ not#lists.isEmpty(kitchenRecipes)}">
<div class="header">Available meals</div>
<tr>
<th style="padding-left: 50px">Image</th>
<th>Meal</th>
<th>Calories</th>
<th>Order</th>
</tr>
<tr th:each="kitchenRecipe : ${kitchenRecipes}">
<td style="float: left!important; margin-left: 10px!important;"><img class="row-image" src="https://www.pikpng.com/pngl/b/64-643199_simple-food-coming-soon-food-clipart.png"></td>
<td style="text-align:center; vertical-align: middle;"><a th:text="${kitchenRecipe.recipeDto.title}"></a></td>
<td style="text-align:center; vertical-align: middle;"><a th:text="${kitchenRecipe.recipeDto.calories}"></a>Calories</td>
<td style="text-align:center; vertical-align: middle;"><a th:href="@{/order/{kitchenId}/{recipeId}(kitchenId=${kitchenRecipe.kitchenDto.id},recipeId=${kitchenRecipe.recipeDto.id})}">View</a></td>
</tr>
</table>
</form>
但是这个表看起来像:
我不知道为什么HTML和CSS都不能解决这个问题。任何帮助都将不胜感激
.box-element{
box-shadow:hsl(0, 0%, 90%) 10 10 16px;
background-color: #ff416c;
border-radius: 4px;
padding: 10px;
margin-bottom:30px;
background: -webkit-linear-gradient(to right, #ff4b2b, #ff416c);
background: linear-gradient(to right, #ff4b2b, #ff416c);
background-repeat: no-repeat;
background-size: cover;
background-position: 0 0;
text-align: center;
vertical-align: middle;
}
.header {
background: #ff416c;
background: -webkit-linear-gradient(to right, #ff4b2b, #ff416c);
background: linear-gradient(to right, #ff4b2b, #ff416c);
background-repeat: no-repeat;
background-size: cover;
background-position: 0 0;
color: white;
font-size: 1.5em;
padding: 1rem;
text-align: center;
text-transform: uppercase;
}