Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

W3C Validation

Featured Replies

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

Edited by Renaissance-Design
Please use the code button or tags to format your code.

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.

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.

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.

  • Author

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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.