V
V
viktorulyushev2017-01-31 10:22:54
PHP
viktorulyushev, 2017-01-31 10:22:54

How to add a slash for all items except the last one?

I'm not strong in PHP, so I'm asking how to add
slashes for the emerging list? The list turns out like this to make that for the last did not form?

<?if (!empty($categories)): ?>
<div style="margin: 100px 0 33px -40px;">
  <ul class="categories1">
  <?foreach ($categories as $catId => $cat):?>
    <li><a href="<? echo $cat['LINK']?>"><? echo $cat['NAME']; ?></a></li>
  <?endforeach;?>
  </ul>
</div>
<?endif;?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2017-01-31
@viktorulyushev

maybe easier to style?

ul>li {
    display: inline-block
}
ul>li+li:before {
    padding: 0 5px;
    color: #ccc;
    content: "/\00a0"
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question