Styling first item of a list differently?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
funcman
Posts: 8
Joined: Wed 20. Jun 2007, 21:50

Styling first item of a list differently?

Post by funcman »

Hello all,

Say you have a file list, or any list generated by phpwcms, and you want to style the very first item differently than the rest (e.g. the first item has no border but the rest of the items have a top-border).

Is there any way to do this?

Thanks!
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Post by Jensensen »

[x]
Last edited by Jensensen on Sat 20. Sep 2008, 03:50, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
kipara
Posts: 26
Joined: Thu 16. Sep 2004, 20:48
Location: Bangkok, Thailand

Post by kipara »

Get creative with the CSS:

If all but the first item have a top border = all items have a bottom border but for the last one.

Set bottom border on all <li>, then apply negative bottom margin on <ul> to "eat" the last border:

#subnav ul { margin: 0 0 -1px 0; }

#subnav li { border-bottom: 1px solid #F00; }

Good luck.

Michiel
Post Reply