Page 1 of 1

Styling first item of a list differently?

Posted: Sat 23. Jun 2007, 21:43
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!

Posted: Sat 23. Jun 2007, 22:11
by Jensensen
[x]

Posted: Mon 25. Jun 2007, 08:56
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