如何每行显示两个项目而不是一个?

时间:2011-03-18 05:42:44

标签: css formatting

http://u.neighborrow.com/groups/oahu

 <?php $session->flash(); ?>
    <div class="user_data">
        <div id="tabs" style="width:100%">
        <ul>
            <li><a href="#tabs-1"><?php echo strtoupper($groupName);?> Have (<?php echo $haveTotal; ?>)</a></li>
            <li><a href="#tabs-2"><?php echo strtoupper($groupName);?> Want (<?php echo $wantTotal; ?>)</a></li></ul>
        <div id="tabs-1">
      <!--<div style="padding:10px;background:orange;margin-top:5px;">
        SEARCH FOR WHAT YOU NEED <input type="text" name="search">
        <a href="http://u.neighborrow.com/items/first">Add New Item</a>
    </div>-->
    <div id="tabs1" >
        <ul>
    <?php foreach($categoryLabels as $k=>$val): ?>
        <li><a href="#<?php echo $k.'Items'; ?>"><?php echo $val; ?> (<?php echo $haveSubTotals[$k];?>)</a></li>
    <?php endforeach; ?></ul>

<?php foreach($items as $k=>$val): ?>
    <div id="<?php echo $k; ?>">
    <ul class="user_have_list">
        <?php if(count($val)): ?>
            <?php foreach($val as $item): ?>
    <li><?= $html->link($item["items"]["item"]. ' ($'.$item['items']['price'].')', array("controller" => "items", "action" => "view", $item["items"]["id"])); ?>
        <div style="padding-top: 5px"> 
                <?php if(! empty($item['items']['image']) && file_exists('images/items/'.$item['items']['image'])){ ?> <img src="<?php echo '/images/items/'.$item['items']['image']; ?>" width="100" />
                <?php } else echo '<img src="/images/noimage.gif" />'; ?>
                    </div>
                </li>
            <?php endforeach; ?>
        <?php else: ?>
            <li class="nothing">Nothing</li>
        <?php endif; ?>
    </ul>
</div>
<?php endforeach; ?>
</div> <!-- #tabs1 -->

</div> <!-- #tabs-1 -->
<div id="tabs-2">
        <div id="tabs2">
            <ul>
                <?php foreach($categoryLabels as $k=>$val): ?>
                    <li><a href="#<?php echo $k.'RequestItems'; ?>"><?php echo $val; ?> (<?php echo $wantSubTotals[$k]; ?>)</a></li>
                <?php endforeach; ?>

            </ul>

        <?php foreach($requests as $k=>$val): ?>
            <div id="<?php echo $k; ?>">
                <ul class="user_have_list">
      <?php if(count($val)): 
                foreach($val as $request): ?>
                                 <li>
   <?php echo $html->link($request["Request"]["item"].' ($'.$request['Request']['price_item'].')', array("controller" => "requests", "action" => "view", $request["Request"]["id"]));
if(! empty($request['Request']['image_path']) ) echo '<img style="padding-top: 5px" src="'.$request['Request']['image_path'].'" width="100" />'; else echo '<img style="padding-top: 5px" src="/images/noimage.gif" />'; ?>
                                        </li>
                                    <?php endforeach; ?>
                                <?php else: ?>
                                    <li class="nothing">Nothing</li>
                                <?php endif; ?>
                            </ul>
                        </div>
                    <?php endforeach; ?>

            </div> <!-- #tabs2 -->

        </div> <!-- #tabs-2 -->

</div>

1 个答案:

答案 0 :(得分:1)

第96行的green.css中的

进行了此更改

ul.user_have_list li {
    background-color: #FAFAFA;
    border: 1px solid #EEEEEE;
    width: 46%;
}

通过添加宽度,它将允许每个项目适合。 这是假设你在谈论将2个搜索结果作为屏幕的底部,因为你的问题非常模糊,你甚至没有提到你想要改变的页面的哪个部分