开发者

Multiple values for rel attribute

Can I have multiple values for rel attributes? Like so:

<a href="#" rel="v开发者_开发百科alue1 nofollow">Link</a>

.. is it valid and cross-browser compatible?


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.


Yes it's valid and it works on all browsers, including IE7 and IE8


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.


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


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.


I tried this with jQuery Mobile and it doesn't work. It works if I remove the second attribute.

rel="external nofollow"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜