gpt4 book ai didi

vertical-alignment - 元素不遵守垂直对齐 : bottom, 为什么?

转载 作者:行者123 更新时间:2023-11-28 09:11:30 36 4
gpt4 key购买 nike

为什么中间元素不遵守vertical-align规则?

我怎样才能让它这样做?

例子:

<div id="outer">
<!-- why doesn't this obey its inline-block and snap to bottom? -->
<div id="inner">From The Smiths</div>
</div>

CSS:

#outer{
top: 0.452873563218px;
left: 23.8988505747126px;
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
width: 284.88275862069px;
height: 58.8229885057471px;
z-index: 5;
font-size: 8.81226053639847px;
position: absolute;
overflow: hidden;
margin: 0;
padding: 0;
}

#inner{
top: 0px;
left: 0px;
font-family: 'Open Sans';
text-align: center;
vertical-align: bottom;
color: rgb(140, 149, 157);
font-weight: 300;
font-size: 8.81226053639847px;
position: relative;
display: inline-block;
width: 100%;
margin: 0;
height: 10px;
padding: 0;
overflow: hidden;

jsbin 链接:http://jsbin.com/mavuhikifi/2/

最佳答案

您可以将外部 div 设置为 display:table,将内部 div 设置为 display:table-cell

#outer {
top: 0.452873563218px;
left: 23.8988505747126px;
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
width: 284.88275862069px;
height: 58.8229885057471px;
z-index: 5;
font-size: 8.81226053639847px;
position: absolute;
overflow: hidden;
margin: 0;
padding: 0;
display: table;
}
#inner {
top: 0px;
left: 0px;
font-family:'Open Sans';
text-align: center;
vertical-align: bottom;
color: rgb(140, 149, 157);
font-weight: 300;
font-size: 8.81226053639847px;
position: relative;
display: table-cell;
width: 100%;
margin: 0;
height: 10px;
padding: 0;
overflow: hidden;
}
<div id="outer">
<!-- why doesn't this obey its inline-block and snap to bottom? -->
<div id="inner">From The Smiths</div>
</div>

或者像 jsFiddle那样使用绝对/相对定位.

关于vertical-alignment - 元素不遵守垂直对齐 : bottom, 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26475962/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com