ul li styling issue

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 10, 2012   (RSS)

By KCMedia - December 10, 2012

Hi

i have this ul li list that is like below and it is drawing the list of the titles from a multisection to display as a drop down menu how can make it so that the last title in the list will have a different style in the drop down than the other ones in the list see the li class none but the others have to have the right styling.

<ul>
<li><a href="#">Nutrition Basics</a></li>
<li><a href="#">G7 Day Rapid shape-Up Plan</a></li>
<li><a href="#">6 Weeks to a New You</a></li>
<li><a href="#">Maintaining your Shape for Life</a></li>
<li><a href="#">Great Shape-Up Recipes</a></li>
<li><a href="#">Food &amp; Nutrition Tables</a></li>
<li class="none"><a href="#">More Great Stuff on Nutrition</a></li>
</ul>
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] ul li styling issue

By Toledoh - December 10, 2012

Rather than doing it in the php, I would do it with css.
http://www.w3schools.com/cssref/sel_last-child.asp
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] ul li styling issue

By KCMedia - December 10, 2012

Hi Tim

i know but i have tried that also but the issue is that because i have this output from cmsb how do i style that into the list

<?php foreach ($nutrition_pagesRecords as $record): ?>
Record Number: <?php echo htmlencode($record['num']) ?><br/>
Title: <?php echo htmlencode($record['title']) ?><br/>
Content: <?php echo $record['content']; ?><br/>
Page Title: <?php echo htmlencode($record['page_title']) ?><br/>
Keywords: <?php echo htmlencode($record['keywords']) ?><br/>
Description: <?php echo htmlencode($record['description']) ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>
<hr/>
<?php endforeach ?>

<?php if (!$nutrition_pagesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

how do i set the last option into the code then.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] ul li styling issue

By Toledoh - December 10, 2012

I would wrap the record in a div and give it a class; ie.

for each....

<div class="block">
Record Number....
_link...
</div>

end for each

Then in the css;

.block{ border-bottom:1px solid red;}
.block:last-child{ border-bottom:none;}
Cheers,

Tim (toledoh.com.au)