开发者

possible to style link rel?

This is probably a stupid question but I'll chance it anyways...

I've got something like...

<link rel='next' title='a title!' href='http开发者_StackOverflow://alink.com' /> 

I'm wondering is it possible for me to style all link rel's with 'next' in an external stylesheet?


Are you sure you're using link right? See the spec here. A <link> tag is only specified in the head of the document and isn't rendered. You might be thinking of anchor (<a/>) tags.

You can specify a CSS attribute selector:

a[rel=next] { color: blue; }

Since IE6 doesn't support the attribute selector, you have a couple of options for complete compatibility. You could just hand code the class of the anchor or use JavaScript.

Here's a JavaScript solution using jQuery (similar syntax), but it's probably not the most ideal for just IE6 and below:

$("a[rel=next]").addClass("myRelClass");


I think what you mean is an anchor tag, not a link tag. And if so, then you can use the following CSS

a[rel='next'] { color: red; }
a[rel='prev'] { color: green; }

to style

<a rel='next' title='a title!' href='http://alink.com' >Next</a>
<a rel='prev' title='a title!' href='http://alink.com' >Previous</a> 

Example here.


In regular webbrowsers this <link> doesn't have any visible representation, so how could you style it?


Just use something like the following in your external CSS file...

link[rel=next] {
   color: red;
}

BTW: You probably mean the HTML-tag <a> e.g. <a href="http://domain.tld">Link</a>

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜