3 回答
TA贡献1839条经验 获得超15个赞
“内联块”的基线是其在正常流中的最后一行框的基线,除非它没有流内行框,或者它的“溢出”属性具有“可见”以外的计算值,在这种情况下,基线是底部边距。
inline-block
vertical-align
baseline
top
.position-data { vertical-align: top;}
TA贡献1982条经验 获得超2个赞
.track-container
vertical-align
此属性影响由内联级别元素生成的框的行框内的垂直定位。
baseline
:
将方框的基线与父框的基线对齐。如果方框没有基线,请将底部边缘与父基准对齐。
“内联块”的基线是其在正常流中的最后一行框的基线,除非它没有流内行框,或者它的“溢出”属性具有“可见”以外的计算值,在这种情况下,基线是底部边距。
top
, middle
bottom
.track-container > * { vertical-align: middle; }
.track-container {
padding: 0;
width: 600px;
height: 200px;
border: 1px solid black;
list-style-type: none;
margin-bottom: 10px;
}
.position-data {
overflow: none;
display: inline-block;
width: 12.5%;
height: 200px;
margin: 0;
padding: 0;
border: 1px solid black;
}
.current-position,
.position-movement {
height: 100px;
width: 100%;
margin: 0;
padding: 0;
border: 1px solid black;
}
.album-artwork {
display: inline-block;
height: 200px;
width: 20%;
border: 1px solid black;
}
.track-info {
display: inline-block;
padding-left: 10px;
height: 200px;
border: 1px solid black;
}
.track-container > * {
vertical-align: middle;
}
<div class="track-container">
<div class="position-data">
<div class="current-position">1</div>
<div class="position-movement">2</div>
</div>
<div class="album-artwork">fdasfdsa</div>
<div class="track-info">fdafdsa</div>
</div>
overflow
visible
hidden
auto
.track-container > * { overflow: hidden; }
.track-container {
padding: 0;
width: 600px;
height: 200px;
border: 1px solid black;
list-style-type: none;
margin-bottom: 10px;
}
.position-data {
overflow: none;
display: inline-block;
width: 12.5%;
height: 200px;
margin: 0;
padding: 0;
border: 1px solid black;
}
.current-position,
.position-movement {
height: 100px;
width: 100%;
margin: 0;
padding: 0;
border: 1px solid black;
}
.album-artwork {
display: inline-block;
height: 200px;
width: 20%;
border: 1px solid black;
}
.track-info {
display: inline-block;
padding-left: 10px;
height: 200px;
border: 1px solid black;
}
.track-container > * {
overflow: hidden;
}
<div class="track-container">
<div class="position-data">
<div class="current-position">1</div>
<div class="position-movement">2</div>
</div>
<div class="album-artwork">fdasfdsa</div>
<div class="track-info">fdafdsa</div>
</div>
一个元素被称为 出流如果它被浮动,则绝对定位,或者是根元素。一个元素被称为 流中如果它不是流出来的话。
float: left
:
.track-container > * > .wrapper { float: left; }
.track-container {
padding: 0;
width: 600px;
height: 200px;
border: 1px solid black;
list-style-type: none;
margin-bottom: 10px;
}
.position-data {
overflow: none;
display: inline-block;
width: 12.5%;
height: 200px;
margin: 0;
padding: 0;
border: 1px solid black;
}
.current-position,
.position-movement {
height: 100px;
width: 100%;
margin: 0;
padding: 0;
border: 1px solid black;
}
.album-artwork {
display: inline-block;
height: 200px;
width: 20%;
border: 1px solid black;
}
.track-info {
display: inline-block;
padding-left: 10px;
height: 200px;
border: 1px solid black;
}
.track-container > * > .wrapper {
float: left;
}
<div class="track-container">
<div class="position-data">
<div class="current-position wrapper">1</div>
<div class="position-movement wrapper">2</div>
</div>
<div class="album-artwork">
<span class="wrapper">fdasfdsa</span>
</div>
<div class="track-info">
<span class="wrapper">fdafdsa</span>
</div>
</div>
TA贡献1856条经验 获得超5个赞
.album-artwork, .track-info { vertical-align:top;}
添加回答
举报