Web Design Forum: W3C Validation - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

W3C Validation

#1 User is offline   jame5payne 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 48
  • Joined: 02-December 11
  • Reputation: 0

Posted 17 January 2012 - 02:11 PM

Hi all.

Just been validating a few of my pages for a site that I'm working on and I have the same error on all my pages. I was just wondering if anyone had any tips or advice on resolving it? It's something to do with a jQuery slideshow I have on my site. Here's an example...

	<!--IMAGE 2-->
	
	<a href="limos.html#anchorposition">
	<img src="images/slides/2.jpg" alt="Image 2" width="930" height="355" title="Fully loaded 12 seater Mercedes limo bus" rel="Fully loaded 12 seater Mercedes limo bus"/>
	</a>



I've pasted the error below.

Line 46, Column 115: there is no attribute "rel"
…55" title="Luxurious 8 seater limousines" rel="Luxurious 8 seater limousines"/>

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Many thanks

James

This post has been edited by Renaissance-Design: 17 January 2012 - 05:07 PM
Reason for edit: Please use the code button or tags to format your code.

0

#2 User is offline   Wickham 

  • Web Guru
  • View gallery
  • Group: Moderators
  • Posts: 2,876
  • Joined: 11-June 09
  • Reputation: 257
  • Gender:Male
  • Location:Salisbury UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 02:45 PM

Delete rel="" for an image src. Always use alt="" and sometimes additionally title="" if you want the text to show as a tooltip in Firefox and some other browsers or for some other purpose but title="" is optional.

<a href="limos.html#anchorposition">
<img src="images/slides/2.jpg" alt="Image 2" width="930" height="355" title="Fully loaded 12 seater Mercedes limo bus/>
</a>

rel is used for stylesheet links in the head section.
0

#3 User is offline   Nitin Reddy 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 55
  • Joined: 11-September 09
  • Reputation: 6
  • Gender:Male
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 03:38 PM

jame5payne,

I don't believe I've ever seen the "rel" attribute used to specify text to describe an image. As Wickham suggests, you should be using the "alt" attribute. The "title" attribute is less commonly used than "alt" because the W3C validator tosses a warning at you if you don't have an "alt" attribute but couldn't care less about the "title" attribute.

If you do have any Javascript that uses the rel attribute, for example to display a caption with a jQuery script, you would have to leave it in and just ignore the W3C validation message.

I remember having to ignore the W3C validation that complained about me placing an H1 tag within an A tag. I had to nest the H1 within the A to make the H1 into a link along with its background image (I used it to display the site logo). It was a popular solution implemented by many web designers and was an alternative to using an IMG tag though, technically, it was improper.
0

#4 User is online   Spitfire 

  • Mighty Pirate™
  • PipPipPipPip
  • Group: Members
  • Posts: 891
  • Joined: 05-February 11
  • Reputation: 189
  • Gender:Male
  • Location:Berkshire
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 03:48 PM

It's not just for stylesheets, you can use the "rel" attribute for any link. It's used to specify the relationship between the current document and the content you're linking to.
0

#5 User is offline   jame5payne 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 48
  • Joined: 02-December 11
  • Reputation: 0

Posted 17 January 2012 - 04:13 PM

If you do have any Javascript that uses the rel attribute, for example to display a caption with a jQuery script, you would have to leave it in and just ignore the W3C validation message.



That's exactly what I'm using it for, a caption for jQuery slider
0

#6 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,595
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 17 January 2012 - 05:07 PM

There's no reason for the slider to use rel when other attributes exist. Can you hack it?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users