我确定以前有人问过这个问题,但我不太确定如何用词来表达我的搜索。
我想要一份事实清单,左边是标题,右边是信息。这是我到目前为止所拥有的:
但是,如果我在右边放太多文字,它不会保持正确对齐,而是在标题下方。
如何让文本保持在右侧对齐?这是我正在使用的 CSS:
.about-fact {
border-bottom: 1px dotted #aaa;
padding: 10px 0;
}
.about-headline {
display: inline-block; /* Aligns the content to be the same */
width: 100px;
float:left;
font-weight: bold;
}
.about-value {
}
示例 HTML:
<div class="about-fact">
<div class="about-headline">Profession:</div>
<div class="about-value">Studying Computer Science at Carleton University</div>
</div>
<div class="about-fact">
<div class="about-headline">Experience:</div>
<div class="about-value">Resume</div>
</div>