两列,两列中的元素使用css堆叠

时间:2013-05-19 13:50:23

标签: html css

我到处寻找答案,但我不认为我是以正确的方式提问。我有两列,但我需要堆叠的元素,似乎无法使任何东西工作。我还想添加背景颜色以使元素脱颖而出。

<style type="text/css">
#showcase {
    width: 100%;
    margin-bottom: 20px;
    margin-top: 4px;
    vertical-align:top;
}
    #showcase > div {
        width: 280px;
        float: left;
        border: 1px solid #ddd;
        padding: 5px;
        vertical-align:top;
        margin-left: 0px;
    }
        #showcase > div:first-child {
            margin-left: 0;
            vertical-align:top;
        }
        #showcase > div > div {

            float: right;
            margin-left: 8px;
            vertical-align:top;
            font: 12px arial, sans-serif;
        }
        #showcase > div > img:last-child {
            width: 150px;
            clear: both;
            margin-top:16px;
            margin-left:0px;
            vertical-align:top;
        }
img.floatLeft { 
float: left; 
margin: 4px; 
}
img.floatRight { 
float: right; 
margin: 4px; 
}

</style>


<div class="module" style="margin-top:0px;">
<div class="module-header"><h3>Product Spotlight</h3></div>
</div>
<div id="showcase">



<? while($row = mysql_fetch_array($products_showcase_query)): ?>

    <div>
        <span style="display: block;font-size:20px;line-height:        130%;margin-bottom:4px;"><?=              $row['product_headline'] ?></span>


        <img src="../product_images/<?= $row['product_image'] ?>" style="width: 134px; float: left;" />

        <div><div class="floatLeft">
            <?= $row['product_summary'] ?>
        </div></div>

        <img src="../product_logos/<?= $row['product_logo'] ?>" />

    </div>

<? endwhile ?>
<span style="display: block;clear:both;"></span>
    </div>

layout example

任何帮助将不胜感激!谢谢:))

0 个答案:

没有答案