The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other The Rules of the Rel Attribute

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #38247
    Taufik Nurrohman

    I’m in a situation like this: I have been using the rel attribute as a kind of data storage and a class replacement for the same group element because my blog does not allow attributes other than rel and href (even data-*, especially in the comment form). The problem is that my attributes are not valid for some value (forget about the invalid & signs. I already know what causes it and it did not matter. As the blog that I use is not an open source platform. I focused on the rel attribute definition only).

    I don’t quite understand because as I know the definition/function of rel attributes is just for a relationship clue that commonly used search engines to help find something and will not affect nothing. But this article and other discussion says that the rel attribute in XHTML only allowed to and elements.
    Is the comment from Chris Pratt in the article can not be a consideration?

    … As long as you’re correctly identifying a relationship, you should not be constrained by what has or has not been added to some approved list. Take rel=”lightbox” for example. This is used all over the web to add lightbox functionality to image galleries …


    Using the rel attribute is kinda a win lose situation. You can use it for stuff like the “lightbox”, but it won’t validate. Not validating isn’t the end of the world though.

    WordPress has a rel attribute hard coded in it that doesn’t validate. Does that mean WordPress is wrong? No, it just means it’s not going to have perfect validation.

    As long as you don’t care about having your site validate perfectly go ahead and use the rel attribute as you see fit. Just don’t go overboard. Only use it if you need to. Most of the time you can get away with classes and id’s rather than rel.

    Taufik Nurrohman

    Thanks for the reply. As I could not use a class or ID, so I used rel. And I think some of the rel value on my blog is not out of human logic (ex: rel="code", rel="pre").
    I don’t even know if WordPress also has some similar problems.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Other’ is closed to new topics and replies.