HTML DIV内联块

时间:2013-04-02 17:46:09

标签: html css

我有这段代码:

<div style="margin-top: 5px"></div>
<div style="width:175px; height: 25px; margin: 0 auto; background-color:#fff;">
    <div style="font-weight: bold; text-align: center; width: 175px; height: 50px; margin:0; font-family: 'Droid Sans', sans-serif; color:#666666; font-size:12px; border:0; height:100%; line-height: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
        Top 5 Números Sorteados
    </div>
</div>
<center>
<div style="margin-top: 1.5px"></div>
<div style="display:inline-block; width:55px; height: 100%; background-color:#fff; ">
    <div style="font-weight: bold; text-align: center; width: 55px; height: 100%; font-family: 'Droid Sans', sans-serif; color:#666666; font-size:12px; height:100%; line-height: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
        <p>1.</p>
        <p>2.</p>
        <p>3.</p>
        <p>4.</p>
        <p>5.</p>
    </div>
</div>
<div style="display:inline-block; width:56px; height: 100%; background-color:#fff; ">
    <div style="font-weight: bold; text-align: center; width: 56px; height: 100%; font-family: 'Droid Sans', sans-serif; color:#666666; font-size:12px; height:100%; line-height: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
        <p>1.</p>
        <p>2.</p>
        <p>3.</p>
        <p>4.</p>
        <p>5.</p>
    </div>
</div>
<div style="display:inline-block; width:55px; height: 100%; background-color:#fff; ">
    <div style="font-weight: bold; text-align: center; width: 55px; height: 100%; font-family: 'Droid Sans', sans-serif; color:#666666; font-size:12px; height:100%; line-height: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
        <p>1.</p>
        <p>2.</p>
        <p>3.</p>
        <p>4.</p>
        <p>5.</p>
    </div>
</div>
</center>

这给了我以下输出:http://jsfiddle.net/VmBR7/

我想知道如何在没有这种边框的情况下制作内联的3个div。我一直在寻找风格选项,但找不到任何可以产生它的东西。感谢

1 个答案:

答案 0 :(得分:2)

内联块元素使用边框呈现自己。可以找到here

为了实现所需,我从inline-block元素中移除了div显示属性,而是将其转换为float:left

然后我将所有底部div元素包裹在父div中,使用与div元素相似的样式

使用内联样式也是不可取的,我重构了一些..

所以这是JSFIDDLE