<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Advanced CSS Links &#8211; Spice Up Your&#160;Links</title> <atom:link href="http://davidwalsh.name/advanced-css-links-spice-up-your-links/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 15:40:33 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Elliott Rodgers</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-7582</link> <dc:creator>Elliott Rodgers</dc:creator> <pubDate>Sun, 01 Feb 2009 18:39:43 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-7582</guid> <description>I use this technique on my website - it works in FF, Opera, Chrome, Safari but not in IE. As a temporary way round the problem, I have all the relevant CSS in an external stylesheet and then use a conditional comment to &quot;reset&quot; the style on each page (code below).This results in users who are not using IE (aka sensible users! :-) ) get the pictures and IE users (poor souls) have plain links... Not an ideal solution... but sometimes it&#039;s not an ideal world sadly.  I have to disagree with Andrea though. IE wont be an A grade browser until Microsoft ensures that IE complies with standards that have been in place for years!ElliottCode:&lt;!--[if IE]&gt;--&gt;
#leftcolumn a.exlink
{
border-width: 0px;
text-decoration: none;
padding-right: 0px;
background: none;
}#leftcolumn a.pdflink
{
border-width: 0px;
text-decoration: none;
padding-right: 0px;
background: none;
}#leftcolumn a.doclink
{
border-width: 0px;
text-decoration: none;
padding-right: 0px;
background: none;
}</description> <content:encoded><![CDATA[<p>I use this technique on my website &#8211; it works in FF, Opera, Chrome, Safari but not in IE. As a temporary way round the problem, I have all the relevant CSS in an external stylesheet and then use a conditional comment to &#8220;reset&#8221; the style on each page (code below).</p><p>This results in users who are not using IE (aka sensible users! :-) ) get the pictures and IE users (poor souls) have plain links&#8230; Not an ideal solution&#8230; but sometimes it&#8217;s not an ideal world sadly.  I have to disagree with Andrea though. IE wont be an A grade browser until Microsoft ensures that IE complies with standards that have been in place for years!</p><p>Elliott</p><p>Code:</p><p><!--[if IE]&gt;--></p><p>#leftcolumn a.exlink<br
/> {<br
/> border-width: 0px;<br
/> text-decoration: none;<br
/> padding-right: 0px;<br
/> background: none;<br
/> }</p><p>#leftcolumn a.pdflink<br
/> {<br
/> border-width: 0px;<br
/> text-decoration: none;<br
/> padding-right: 0px;<br
/> background: none;<br
/> }</p><p>#leftcolumn a.doclink<br
/> {<br
/> border-width: 0px;<br
/> text-decoration: none;<br
/> padding-right: 0px;<br
/> background: none;<br
/> }</p> ]]></content:encoded> </item> <item><title>By: Bert</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-1607</link> <dc:creator>Bert</dc:creator> <pubDate>Tue, 10 Jun 2008 02:41:09 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-1607</guid> <description>As well as Andreas&#039; &quot;:after&quot; tip you can also use &quot;:before&quot; , for examplea[href$=&#039;.pdf&#039;]:before { content: url(/icons/pdf.gif); padding: 0 5px 0 0; }Also, as well as defining file extensions you can also distinguish links to individual websites;a[href*=&#039;youtube&#039;]:before { content: url(/icons/youtube.gif); padding: 0 5px 0 0; }
a[href*=&#039;wikipedia&#039;]:before { content: url(/icons/wiki.gif); padding: 0 5px 0 0; }Now, can anyone tell me if it&#039;s possible to have a default icon when all other rules fail?</description> <content:encoded><![CDATA[<p>As well as Andreas&#8217; &#8220;:after&#8221; tip you can also use &#8220;:before&#8221; , for example</p><p>a[href$='.pdf']:before { content: url(/icons/pdf.gif); padding: 0 5px 0 0; }</p><p>Also, as well as defining file extensions you can also distinguish links to individual websites;</p><p>a[href*='youtube']:before { content: url(/icons/youtube.gif); padding: 0 5px 0 0; }<br
/> a[href*='wikipedia']:before { content: url(/icons/wiki.gif); padding: 0 5px 0 0; }</p><p>Now, can anyone tell me if it&#8217;s possible to have a default icon when all other rules fail?</p> ]]></content:encoded> </item> <item><title>By: davidwalsh83</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-15</link> <dc:creator>davidwalsh83</dc:creator> <pubDate>Sat, 11 Aug 2007 13:24:07 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-15</guid> <description>Thanks for the &#039;:after&#039; tidbit.One rule I have for designing my sites is that I don&#039;t place links within content paragraphs.  I place the conversion link after the paragraph to make it stand out, much like my example link.</description> <content:encoded><![CDATA[<p>Thanks for the &#8216;:after&#8217; tidbit.</p><p>One rule I have for designing my sites is that I don&#8217;t place links within content paragraphs.  I place the conversion link after the paragraph to make it stand out, much like my example link.</p> ]]></content:encoded> </item> <item><title>By: Andrea</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-14</link> <dc:creator>Andrea</dc:creator> <pubDate>Fri, 10 Aug 2007 15:55:48 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-14</guid> <description>David,it&#039;s a pleasure!I&#039;m all for progressive enhancement, too, but if a solution fails &#039;ungracefully&#039; in an A-grade browser such as IE7, the term doesn&#039;t apply.In my view Daniel&#039;s - clever - solution may save the day most of the time but would prove unacceptable in still too many cases, as it means that a design constraint limits your editorial choice (in particular if you have relatively narrow text columns) - and as he said, where the rule applies the result tends to be a bit ugly (and sometimes maybe even *very* ugly :o))From this point of view, Dave&#039;s :after solution seems more reliable: the following works in Firefox and doesn&#039;t break neither in IE6 nor in IE7 (haven&#039;t tried Opera or Safari, though):a[href$=&#039;.pdf&#039;]:after {content: &quot; &quot;url(/graphics/icons/pdf.gif)}Thanks to all for the tips.</description> <content:encoded><![CDATA[<p>David,</p><p>it&#8217;s a pleasure!</p><p>I&#8217;m all for progressive enhancement, too, but if a solution fails &#8216;ungracefully&#8217; in an A-grade browser such as IE7, the term doesn&#8217;t apply.</p><p>In my view Daniel&#8217;s &#8211; clever &#8211; solution may save the day most of the time but would prove unacceptable in still too many cases, as it means that a design constraint limits your editorial choice (in particular if you have relatively narrow text columns) &#8211; and as he said, where the rule applies the result tends to be a bit ugly (and sometimes maybe even *very* ugly :o))</p><p>From this point of view, Dave&#8217;s :after solution seems more reliable: the following works in Firefox and doesn&#8217;t break neither in IE6 nor in IE7 (haven&#8217;t tried Opera or Safari, though):</p><p>a[href$='.pdf']:after {content: &#8221; &#8220;url(/graphics/icons/pdf.gif)}</p><p>Thanks to all for the tips.</p> ]]></content:encoded> </item> <item><title>By: davidwalsh83</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-13</link> <dc:creator>davidwalsh83</dc:creator> <pubDate>Fri, 10 Aug 2007 01:20:33 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-13</guid> <description>Thank you for posting Dave, Daniel, and Andrea!  The idea in this situation is to use CSS to enhance -- these &quot;spiced&quot; up links aren&#039;t meant as a necessity.  Great solution too Daniel!</description> <content:encoded><![CDATA[<p>Thank you for posting Dave, Daniel, and Andrea!  The idea in this situation is to use CSS to enhance &#8212; these &#8220;spiced&#8221; up links aren&#8217;t meant as a necessity.  Great solution too Daniel!</p> ]]></content:encoded> </item> <item><title>By: daniel</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-12</link> <dc:creator>daniel</dc:creator> <pubDate>Thu, 09 Aug 2007 21:23:05 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-12</guid> <description>surely you could use a {white-space:nowrap;} to avoid the problem above. It might make really long links and paragraphs containing them a bit ugly, so the solution is to not use long links :)i would see no special reason to dress up IE6 specifically. im all for progressive enhancement.</description> <content:encoded><![CDATA[<p>surely you could use a {white-space:nowrap;} to avoid the problem above. It might make really long links and paragraphs containing them a bit ugly, so the solution is to not use long links :)</p><p>i would see no special reason to dress up IE6 specifically. im all for progressive enhancement.</p> ]]></content:encoded> </item> <item><title>By: Andrea</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-11</link> <dc:creator>Andrea</dc:creator> <pubDate>Thu, 09 Aug 2007 15:30:29 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-11</guid> <description>Dave,true. I was hoping for a solution that would work in IE6 and without javascript, but after all your second option would work fine in most scenarios, so as long as it isn&#039;t critical to have the links properly &#039;dressed up&#039;, why not.</description> <content:encoded><![CDATA[<p>Dave,</p><p>true. I was hoping for a solution that would work in IE6 and without javascript, but after all your second option would work fine in most scenarios, so as long as it isn&#8217;t critical to have the links properly &#8216;dressed up&#8217;, why not.</p> ]]></content:encoded> </item> <item><title>By: Dave</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-10</link> <dc:creator>Dave</dc:creator> <pubDate>Thu, 09 Aug 2007 13:37:32 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-10</guid> <description>General solution to IE wrapping problem:Use CSS :after speudo selector with the content attribute for browsers that support it, or use JavaScript to loop though the links and add the image.</description> <content:encoded><![CDATA[<p>General solution to IE wrapping problem:</p><p>Use CSS :after speudo selector with the content attribute for browsers that support it, or use JavaScript to loop though the links and add the image.</p> ]]></content:encoded> </item> <item><title>By: Andrea</title><link>http://davidwalsh.name/advanced-css-links-spice-up-your-links/comment-page-1#comment-9</link> <dc:creator>Andrea</dc:creator> <pubDate>Thu, 09 Aug 2007 09:54:20 +0000</pubDate> <guid
isPermaLink="false">http://www.davidwalsh.name/advanced-css-links-spice-up-your-links/#comment-9</guid> <description>This is ok in Firefox but - as you said - doesn&#039;t work in IE6, because the latter doesn&#039;t support the attribute selection in CSS.Unfortunately, this approach breaks in IE7 - precisely because IE7 *does* support the attribute selection!Indeed, if your link wraps over two lines, you&#039;ll have an unpleasant surprise.I think the way IE works is as follows: for the background&#039;s dimensions calculation, you will not have a slim box of the height of a line wrapping like a snake over different lines, but a single box that holds them all. As a consequence:
+ the background&#039;s right will be the rightmost point of any of the lines involved (not of the last, as in Firefox);
+ the background&#039;s height center will be the center of the height of all the lines combined (again, not only of the last);
+ however, the right padding will be added only to the last line;
= Disaster: the image will display to the right of the block of text (not of your link&#039;s last line) and somewhere centered between all the lines of the link (usually you&#039;ll only see a small part of it at the right of the first line, covered by the link&#039;s text).The same applies to IE6 if you extend this technique by using classes to mark the links you want to apply such a rule to.I met this problem a couple of years ago when I tried to implement exactly the same solution, and had to use an ugly workaround which would only work under certain conditions - which were met in the specific context pf my problem. Maybe somebody has a general solution for it?</description> <content:encoded><![CDATA[<p>This is ok in Firefox but &#8211; as you said &#8211; doesn&#8217;t work in IE6, because the latter doesn&#8217;t support the attribute selection in CSS.</p><p>Unfortunately, this approach breaks in IE7 &#8211; precisely because IE7 *does* support the attribute selection!</p><p>Indeed, if your link wraps over two lines, you&#8217;ll have an unpleasant surprise.</p><p>I think the way IE works is as follows: for the background&#8217;s dimensions calculation, you will not have a slim box of the height of a line wrapping like a snake over different lines, but a single box that holds them all. As a consequence:<br
/> + the background&#8217;s right will be the rightmost point of any of the lines involved (not of the last, as in Firefox);<br
/> + the background&#8217;s height center will be the center of the height of all the lines combined (again, not only of the last);<br
/> + however, the right padding will be added only to the last line;<br
/> = Disaster: the image will display to the right of the block of text (not of your link&#8217;s last line) and somewhere centered between all the lines of the link (usually you&#8217;ll only see a small part of it at the right of the first line, covered by the link&#8217;s text).</p><p>The same applies to IE6 if you extend this technique by using classes to mark the links you want to apply such a rule to.</p><p>I met this problem a couple of years ago when I tried to implement exactly the same solution, and had to use an ugly workaround which would only work under certain conditions &#8211; which were met in the specific context pf my problem. Maybe somebody has a general solution for it?</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 1/16 queries in 0.017 seconds using disk: basic
Object Caching 800/801 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 11:36:35 -->
