Solved

W3C Validator does not like this line in stylesheet

Posted on 2011-03-07
2
359 Views
Last Modified: 2012-05-11
Hi!

The W3C validator does not like this line in stylesheet
ul.dropdown li:last-child a{border-right:none;}
It says "Unknown pseudo-element or pseudo-class :last-child"
Any specific code modification would be appreciated.

0
Comment
Question by:TrueBlue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Assisted Solution

by:LZ1
LZ1 earned 50 total points
ID: 35059923
The pseudo code :last-child is not valid in the CSS 2.1 spec.  If you change to validate in CSS 3 it should pass.

Work around: You can class the last LI in your code and then apply your CSS that way
0
 
LVL 14

Accepted Solution

by:
Designbyonyx earned 75 total points
ID: 35060365
LZ1 is right.  You really need to use a class name, as the :last-child pseudo class is part of CSS3, which is not supported by any current version of IE, and it will be another 2 years beofre IE9 has wide enough market share.

So your code would look like this:

<ul class="dropdown">
  <li><a href="#">Link 1</a></li>
  <li><a href="#">Link 1</a></li>
  <li><a href="#">Link 1</a></li>
  <li class="last"><a href="#">Link 1</a></li>
</ul>

Open in new window


If for whatever reason you can't edit the code of the menu, then you can use javascript... in this example I am using jQuery:

$('ul.dropdown li:last').addClass('last');

Open in new window


And your CSS like this:

ul.dropdown li.last a{ border-right:none; }

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question