このフィドルで...
http://jsfiddle.net/jeljeljel/sARz2/
太字の日付値を親コンテナーの右側に揃える必要があります。:last-child 疑似要素を使用して、これを実現するにはどうすれば css を調整できますか? 以下のcssでこれを試みています。
HTML
<div class="editIssueForm">
<div class="commentContainer">
<div>
<div class="comment">
<div>
<span>Entered by: Paul Reid</span>
<span>4/3/2013 3:45 PM CST</span>
</div>
<div>ipsum dolor sit amet, consectetur adipiscing elit. Praesent pulvinar, lectus vitae rutrum accumsan, ligula mauris bibendum magna, vel vestibulum erat ante vel metus. Integer blandit, libero eu dignissim pellentesque, massa lectus placerat mi, eu adipiscing neque velit vitae turpis. Maecenas iaculis dui in urna iaculis mattis. Suspendisse ut erat turpis. Nullam pulvinar fringilla semper. Nulla facilisi. Nunc eu tortor eu ipsum adipiscing facilisis. Proin lacinia quam non nulla fermentum a cursus nunc consequat. Suspendisse id diam orci, sed pretium nibh. Sed eros tortor</div>
</div>
</div>
</div>
</div>
CSS
.editIssueForm {
border: 1px solid lightblue;
width: 300;
}
.editIssueForm .commentContainer {
width: 300;
height: 200;
overflow-y: scroll;
}
.editIssueForm .commentContainer .comment {
padding-left: 5px;
}
.editIssueForm .commentContainer .comment div:first-child {
font-weight: bold;
display: inline-block;
}
これらの疑似セレクターは機能しません。それらを機能させるためにcssをどのように調整できますか?
.editIssueForm .commentContainer .comment div:first-child span:first-child {
float: left;
padding-left: -5px;
}
.editIssueForm .commentContainer .comment div:first-child span:last-child {
float: right;
}
終わり
.editIssueForm .commentContainer .comment div:first-child:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.editIssueForm .commentContainer .comment:nth-child(n+2) {
border-top: 1px solid #ddd;
padding-top: 5px;
margin-top: 5px;
}