Make WordPress Core

Opened 7 years ago

Closed 4 years ago

Last modified 4 years ago

#9011 closed enhancement (wontfix)

Add last CSS class for UL and OL Lists

Reported by: viriava Owned by:
Milestone: Priority: low
Severity: minor Version: 2.8
Component: Template Keywords: close 2nd-opinion
Focuses: Cc:


In Ul and OL lists add CSS class like: class="last" for last list's item.


<li>item 01</li>

<li>item 02</li>

<li>item 03</li>

<li class="last">item 04</li>


It will be helpful for theme styling.

Change History (18)

#1 @viriava
7 years ago

Also, will be good add class="first"


<li class="first">item 01</li>

<li>item 02</li>

<li>item 03</li>

<li class="last">item 04</li>


7 years ago

  • Milestone changed from 2.8 to Future Release

#3 @alexdunae
7 years ago

One of my plugins does this: Classy wp_list_pages: http://wordpress.org/extend/plugins/classy-wp-list-pages/

#4 @Nicholas91
7 years ago

I disagree, because I'm not sure how many people would find styling the first and last item of an ol/ul useful. They should use the plugin above instead...

#5 @Denis-de-Bernardy
7 years ago

  • Component changed from Themes to Template
  • Owner set to anonymous

isn't this done in the walker classes already?

#6 @Denis-de-Bernardy
7 years ago

  • Priority changed from normal to low
  • Severity changed from normal to minor

#7 @wojtek.szkutnik
5 years ago

:first-child and :last-child are compatible with all modern browsers, isn't it sufficient?

#8 @nacin
5 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

We've discussed this elsewhere and using CSS selectors has generally prevailed previously. As we continue to hold that argument of HTML versus CSS, the bad browsers will die off and the current browsers will only get better, so no use leaving this open longer.

#9 @hm2k
4 years ago

  • Keywords changed from css, xhtml to css xhtml
  • Resolution wontfix deleted
  • Status changed from closed to reopened

As far as I am aware, Wordpress supports _all_ browsers, including older ones (unlike Yahoo's Graded Browser support)

Using :first-child shouldn't be a problem as it was part of the 1998 CSS2 specification.

However, :last-child was introduced in the 2009 "Selectors Level 3" specification.

According to litmus tests, IE6, IE7 and IE8 do not support :last-child.

According to Microsoft IE6 still over 9% world wide market share, while others report around 40% market share for Internet Explorer overall.

While I agree, and hope that bad browsers will "die off", surely we can't ignore _current_ browsers.

#10 @SergeyBiryukov
4 years ago

  • Milestone set to Awaiting Review

Since WordPress 3.2, IE6 is deprecated, and IE7 is going to be deprecated in 3.4.

As a workaround, it's probably possible to use jQuery or some other workaround.

#11 @SergeyBiryukov
4 years ago

  • Keywords close added; css xhtml removed

#12 @hm2k
4 years ago

Right now, IE8 has the biggest market share at almost 20% or are we ignoring that?

Microsoft will continue to support IE8 until it stops supporting Windows Server 2008 in 2013, possibly 2018.

When a native CSS solution is so simply to implement in the core by adding a class to the markup, javascript workarounds aren't the answer.

#13 @SergeyBiryukov
4 years ago

  • Keywords 2nd-opinion added

#14 @hm2k
4 years ago

  • Cc hm2k added
  • Version changed from 2.8 to 3.2.1

#15 @SergeyBiryukov
4 years ago

  • Version changed from 3.2.1 to 2.8

Version number is used to track when the issue was initially reported.

#16 @hm2k
4 years ago

  • Type changed from feature request to enhancement

More of an enhancement than a feature.

#17 @dd32
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

In the last 3 years the psuedo selector support has increased dramatically, and whilst we do "Support" old browsers, things such as list styling should be seen as graceful-degradation.

I'm reclosing as wontfix, as it's of little benefit to those using modern browsers - and the JavaScript tools to add missing features to old browsers are becoming more commonly needed for HTML5/etc support anyway.

#18 @lkraav
4 years ago

  • Cc lkraav added
Note: See TracTickets for help on using tickets.