html - 如何让跨度边距留在 div 旁边,并垂直对齐中心?
问题描述
如何让跨度边距留在 div 旁边,并垂直对齐中心?
红色框架是div
,绿色框架是span
。外部div
元素是 div。
<div>
<span style="width: 100%; margin: auto auto auto 0;">0台</span>
</div>
我试过使用margin
,display:inline-block;
都失败了。
我想span
搬到那里:
编辑-1
我div
是使用 Colspan
属性作为宽度。
<Col :span=8>
<div>
<span>...
</div>
</Col>
解决方案
请使用display:table
and进行样式设置display:table-cell
:
<div style="width: 500px;height:200px;display:table;">
<span style="width:100%; display:table-cell;
vertical-align:middle;">0台</span>
</div>
推荐阅读
- c++ - 大型输入文件的程序失败,非常适合较小的输入文件
- r - 如何删除由 ggplot2 中的错误栏创建的负值?
- c# - 从 C# 调用 DLL 函数时内存冲突
- docker - 访问远程服务器(GCE)上暴露的(通过docker)端口的问题
- r - 当使用 `checkpoint()` 从 MRAN 安装软件包时,`软件包在存储库中不可用并且不会被安装`
- angular - 使用 ionic 上的点击事件,根据用户需要多次生成组件
- excel - 在各种标题下方插入 Excel 中的文本
- pandas - 将多行附加到熊猫的单行中
- neo4j - Neo4j - 如何在全文索引中给予最近时间戳更多的权重?
- python - 是否可以从 CSV 文件的备用列中读取主列中的 NaN 值?