문제

My goal is to create a dynamic list of links next to each other (not on top of each other). So far I have the links outputting correctly using Simplepie and an Atom datasource but for some reason my output has a linebreak between each new item in the for each statement. Is it possible to skip the line break and put the output items next to each other instead? I am not getting any errors, just not getting my goal output. Please help this is making me age at an exponential rate :)

<body>
<?php
foreach ($feed->get_items() as $item):
?>
<div class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item-    >get_title(); ?></a></div><?php endforeach; ?>
</body>
도움이 되었습니까?

해결책

Put the links in a <ul> (Unordered list element) with style of float:left like so

<body>
    <ul>
        <?php
            foreach ($feed->get_items() as $item):?>
                <li class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item- >get_title(); ?></a>
                </li>
            <?php endforeach; ?>
    </ul>
</body>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top