0
在我的HTML中,我試圖對齊標題旁邊的標題,以便標題的第一行總是在子彈旁邊,而第二行(如果有的話)不會更改標題的位置 - 它只是追溯到下一行。如何對齊固定高度div旁邊的變高度div?
的jsfiddle:
HML:
<div class="bullet-container">
<div class="bullet-title-container">
<div class="circle-container">
<div class="circle"></div>
</div>
<p class="bullet-title">Short Title</p>
</div>
<div class="bullet-details-container">
<p>Body Text</p>
</div>
</div>
CSS:
.circle-container {
height: 34px;
display: inline-block;
position: relative;
width: 14px;
border: 1px solid blue;
}
.circle {
border-radius: 50% !important;
width: 12px;
height: 12px;
background-color: red;
display: inline-block;
position: absolute;
top: 0px;
/* width and height can be anything, as long as they're equal */
}
.bullet-title {
display: inline-block;
font-size: 16px;
font-weight: bold;
margin-left: 10px;
min-height: 34px;
width: 200px;
margin: 0px;
}
.bullet-title-container {
color: black;
display: inline-block;
position: relative;
width: 250px;
}
.bullet-details-container {
color: black;
}
.bullet-container {
max-width: 600px;
float: left;
text-align: left;
}
現在所發生的是,第一行總是太低,如果有多行,整個標題被推高得太高。我認爲對齊兩個內聯塊元素會起到訣竅的作用,但似乎並不奏效。我究竟做錯了什麼?