以下是我的问题的图片:http://i48.tinypic.com/2roszr9.jpg。 我想问你是否知道如何将数字置于蓝色框中,位于绿色框的中间。因此,如果绿色框中的文本更长,我想在本文中间居中标题数。这是代码:
<style>
.right-content-text {
width: 235px;
}
.right-content-text p {
background: red;
float: left;
width: 235px;
height: auto;
}
span.index {
background: blue;
width: 35px;
float: left;
text-align: center;
font-size: 14px;
color: #373A40;
font-weight: bold;
}
span.text {
width:200px;
background: green;
vertical-align:middle;
float: right;
}
span.text a {
text-decoration: none;
font-size: 14px;
font-weight: normal;
color: #373A40;
}
</style>
<div class="right-content-text">
<p><span class="index">2.</span><span class="text"><a href="#">Lorem ipsum dolor sit amet</a></span><div class="clear"></div></p>
<p><span class="index">3.</span><span class="text"><a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a></span><div class="clear"></div></p>
<p><span class="index">4.</span><span class="text"><a href="#">Pellentesque aliquet pulvinar tortor, sed pretium nisl mollis eget. </a></span><div class="clear"></div></p>
<p><span class="index">5.</span><span class="text"><a href="#">Fusce vestibulum molestie quam, et lacinia nibh egestas quis.</a></span><div class="clear"></div></p>
</div>
答案 0 :(得分:0)
嘿,现在你可以用
了 display: table-cell;
在您的文字课程中。
span.index {
background: blue;
width: 35px;
display:table-cell;
vertical-align:middle;
text-align: center;
font-size: 14px;
color: #373A40;
font-weight: bold;
}
span.text {
width:200px;
background: green;
display:table-cell;
vertical-align:middle;
}