remove last separator?

Here is a completely different approach to the problem. Since the slashes may be considered to be presentational, they should not go into the HTML. Users without CSS just get to see a regular list.

You could then use CSS to restyle the list and add the slashes in between.

#nav li { display:inline; }
#nav li:before { content:"https://wordpress.stackexchange.com/"; }
#nav li:first-child:before { content:''; }

Check it out here.

Note: this will not work in IE7 and older. IE7 does support :first-child but :before only works from IE8.

Leave a Comment