Reputation: 68680
Can I have multiple values for rel attributes? Like so:
<a href="#" rel="value1 nofollow">Link</a>
.. is it valid and cross-browser compatible?
Upvotes: 55
Views: 35285
Reputation: 26101
It's valid. I'm not sure if it's supported by all browsers, though, but I would guess that it is.
rel = link-types [CI] This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types.
Upvotes: 72
Reputation: 58087
Definitely valid.
You can also do the same thing with the class attribute. This is handy for CSS styling.
HTML:
<span class="foo bar more classes">Stuff</span>
<span class="bar">More bar</span>
CSS
.foo{
color: #afafaf;
}
.bar{
border: 1px solid #0ff;
}
The first span would be gray and have the blue border, while the second span would just have the border.
Upvotes: 5
Reputation: 386
yes you can and it's valid: e.g: rel='tag nofollow'
<a expr:href='data:label.url' rel='tag nofollow'><data:label.name/></a>
just use values with giving "blank space" among them. The complete details of tags used inside rel are here..
http://www.w3schools.com/tags/att_a_rel.asp
Upvotes: 3
Reputation: 11
I tried this with jQuery Mobile and it doesn't work. It works if I remove the second attribute.
rel="external nofollow"
Upvotes: 0
Reputation: 503
Actually it isn't valid according to Structured Data Testing Tool.
I tried this tonight, using the following
rel="publisher nofollow"
and it failed to validate the publisher. As soon as I removed the nofollow is validated ok again.
I thought I would post my answer, as I came across this thread after doing a Google search for the same question.
Upvotes: 0
Reputation: 61
Yes it's valid and it works on all browsers, including IE7 and IE8
Upvotes: 6