WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 2 years ago

Last modified 2 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:

Description

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

<ul>

<li>item 01</li>

<li>item 02</li>

<li>item 03</li>

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

</ul>

It will be helpful for theme styling.

Change History (18)

comment:1 viriava5 years ago

Also, will be good add class="first"

<ul>

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

<li>item 02</li>

<li>item 03</li>

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

</ul>

comment:2 FFEMTcJ5 years ago

  • Milestone changed from 2.8 to Future Release

comment:3 alexdunae5 years ago

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

comment:4 Nicholas915 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...

comment:5 Denis-de-Bernardy5 years ago

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

isn't this done in the walker classes already?

comment:6 Denis-de-Bernardy5 years ago

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

comment:7 wojtek.szkutnik4 years ago

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

comment:8 nacin4 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.

comment:9 hm2k3 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.

comment:10 SergeyBiryukov3 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.

comment:11 SergeyBiryukov3 years ago

  • Keywords close added; css xhtml removed

comment:12 hm2k3 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.

comment:13 SergeyBiryukov3 years ago

  • Keywords 2nd-opinion added

comment:14 hm2k3 years ago

  • Cc hm2k added
  • Version changed from 2.8 to 3.2.1

comment:15 SergeyBiryukov3 years ago

  • Version changed from 3.2.1 to 2.8

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

comment:16 hm2k3 years ago

  • Type changed from feature request to enhancement

More of an enhancement than a feature.

comment:17 dd322 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.

comment:18 lkraav2 years ago

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