这是我的问题的图像: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>