如何将下面这段代码中的文字在div中高度处在中间显示 <div id="div_add"> <a th:href="@{/manager/add_spot.html}">添加景点</a> </div>
时间: 2023-08-14 18:52:49 浏览: 46
要在div中将文字垂直居中显示,可以使用CSS的`display: flex;`和`align-items: center;`属性。将这两个属性添加到`#div_add`的样式中,如下所示:
```html
<style>
#div_add {
display: flex;
align-items: center;
}
</style>
<div id="div_add">
<a th:href="@{/manager/add_spot.html}">添加景点</a>
</div>
```
这样,`<a>`标签中的文字将在div中垂直居中显示。
相关问题
如何将下面这段代码中的文字在div中处于正中间 <div id="div_add"> <a th:href="@{/manager/add_spot.html}">添加景点</a> </div>
要将文字在div中居中,可以使用CSS来实现。你可以将下面的代码添加到你的CSS文件中或者直接在HTML文件中使用style标签。
```html
<style>
#div_add {
display: flex;
justify-content: center;
align-items: center;
}
</style>
```
将上述代码添加到你的HTML文件中,然后将你的div标签修改为以下形式:
```html
<div id="div_add">
<a th:href="@{/manager/add_spot.html}">添加景点</a>
</div>
```
这样就可以使文字在div中水平和垂直居中了。
如何将下面这段代码中的文字在div中居中显示 <div id="div_add"> <a th:href="@{/manager/add_spot.html}">添加景点</a> </div>
要在div中将文字居中显示,可以使用CSS的`text-align`属性。将`text-align: center;`添加到`#div_add`的样式中,如下所示:
```html
<style>
#div_add {
text-align: center;
}
</style>
<div id="div_add">
<a th:href="@{/manager/add_spot.html}">添加景点</a>
</div>
```
这样,`<a>`标签中的文字将在div中水平居中显示。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
添加
修改
删除
手动运行数据更新器 选中 时间 总居民消费CPI 食品类CPI 衣着类CPI 居住类CPI 服务类CPI 交通通信类CPI 教育类CPI 医药类CPI 其他类CPI <c:forEach items="${cpi}" var="i"> <input name="radiobox" type="radio" value=${i.TIMES}/> <c:if test="${i.TIMES==999999}"> 预测本月 </c:if> <c:if test="${i.TIMES!=999999}"> ${i.TIMES} </c:if> ${i.CPI} ${i.FOOD} ${i.CLOTH} ${i.RESIDE} ${i.SERVICE} ${i.TRANS} ${i.EDU} ${i.MEDIC} ${i.OTHER} </c:forEach> 我希望页面在点击修改和删除的时候把单选框的value提交给服务器,我应该怎么改
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)