<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Psyked &#187; CSS</title>
	<atom:link href="http://www.psyked.co.uk/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.psyked.co.uk</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 15:02:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Targeting multiple browsers with CSS&#8230; and some Javascript trickery.</title>
		<link>http://www.psyked.co.uk/css/targeting-multiple-browsers-with-css-and-some-javascript-trickery.htm</link>
		<comments>http://www.psyked.co.uk/css/targeting-multiple-browsers-with-css-and-some-javascript-trickery.htm#comments</comments>
		<pubDate>Sat, 28 Nov 2009 08:00:19 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://There&#039;sacleverlittlejavascriptlibrarythatallowsyoutowriteCSSspecificallyforChrome,theiPhone,IE8,etc.allinasinglefile. WhatitdoesismanipulatetheHTMLdocumentclient-sidetoaddadditionalclassestothepage,basedonyour</guid>
		<description><![CDATA[There&#8217;s a clever little javascript library that allows you to write CSS specifically for Chrome, the iPhone, IE 8, etc. all in a single file.  What it does is manipulate the HTML document client-side to add additional classes to the page, based on your browser type.  The end result is that your page gets additional [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a clever little javascript library that allows  you to write CSS specifically for Chrome, the iPhone, IE 8, etc. all in a single file.  What it does is manipulate the HTML document client-side to add additional classes to the page, based on your browser type.  The end result is that your page gets additional selectors like .ie or .gecko added &#8211; and you can setup a single CSS file to target all of these browsers in one shot &#8211; no server side magic or conditional comments in the HTML.</p>
<p>You can find  more information here ( <a href="http://snipplr.com/view/9340/css-browser-selector/">http://snipplr.com/view/9340/css-browser-selector/</a> ) or download it from here (<a href="http://github.com/rafaelp/css_browser_selector">http://github.com/rafaelp/css_browser_selector</a> ).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/css/targeting-multiple-browsers-with-css-and-some-javascript-trickery.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Everything you know about CSS is wrong.</title>
		<link>http://www.psyked.co.uk/css/everything-you-know-about-css-is-wrong.htm</link>
		<comments>http://www.psyked.co.uk/css/everything-you-know-about-css-is-wrong.htm#comments</comments>
		<pubDate>Fri, 31 Oct 2008 20:04:04 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tables]]></category>

		<guid isPermaLink="false">http://www.digital-web.com/articles/everything_you_know_about_CSS_is...</guid>
		<description><![CDATA[http://www.digital-web.com/articles/everything_you_know_about_CSS_is&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.digital-web.com/articles/everything_you_know_about_CSS_Is_wrong/" target="_blank"><img class="alignnone size-full wp-image-1443" title="Everything you know about CSS is wrong" src="http://uploads.psyked.co.uk//2008/10/digital-web-css-is-wrong.png" alt="" width="500" height="280" /></a></p>
<p><a href="http://www.digital-web.com/articles/everything_you_know_about_CSS_Is_wrong/" target="_blank">http://www.digital-web.com/articles/everything_you_know_about_CSS_is&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/css/everything-you-know-about-css-is-wrong.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Selection Styles?</title>
		<link>http://www.psyked.co.uk/css/css-selection-styles.htm</link>
		<comments>http://www.psyked.co.uk/css/css-selection-styles.htm#comments</comments>
		<pubDate>Sun, 24 Feb 2008 12:00:40 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Did you know you could customize the selection colours of html pages with CSS?  I didn&#8217;t &#8211; until now.  Turns out, there&#8217;s a CSS3 pseudo-element called ::selection.  Naturally, this isn&#8217;t yet a technique supported by browsers like Internet Explorer, but it is supported in [albeit with different syntax] by Firefox and Safari.  Interesting, eh?  Check [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know you could customize the selection colours of html pages with CSS?  I didn&#8217;t &#8211; until now.  Turns out, there&#8217;s a <a href="http://www.w3.org/TR/css3-selectors/#UIfragments" title="Open link in a new window" target="_blank">CSS3 pseudo-element called ::selection</a>.  Naturally, this isn&#8217;t yet a technique supported by browsers like Internet Explorer, but it is supported in [albeit with different syntax] by Firefox and Safari.  Interesting, eh?  Check an article on <a href="http://www.quirksmode.org/css/selection.html" title="Open link in a new window" target="_blank">CSS Selection Styles from Quirksmode</a>, and have a look at some of the creative effects you can get with it <a href="http://metaatem.net/selcolor.php" title="Open link in a new window" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/css/css-selection-styles.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatic Link Icons v2.0</title>
		<link>http://www.psyked.co.uk/css/automatic-link-icons-v20.htm</link>
		<comments>http://www.psyked.co.uk/css/automatic-link-icons-v20.htm#comments</comments>
		<pubDate>Tue, 08 Jan 2008 20:20:05 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[External links]]></category>
		<category><![CDATA[Icons]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Wow. My previous post, Auto-matic Link Icons is by far the most popular on Psyked. It&#8217;s even been translated into Russian! Things are constantly evolving, and I thought it only suitable that I should expand upon the original with a few new ideas, techniques and general improvements. So, without further ado: Improving the Icon Display; [...]]]></description>
			<content:encoded><![CDATA[<p>Wow.  My previous post, <a href="/css/auto-matic-link-icons.htm" title="Open link in the same window">Auto-matic Link Icons</a> is by far the most popular on Psyked.  It&#8217;s even been <a href="http://blog.bagg.spb.ru/2007/11/148/" title="Open link in a new window" target="_blank">translated into Russian!</a>  Things are constantly evolving, and I thought it only suitable that I should expand upon the original with a few new ideas, techniques and general improvements.  So, without further ado:</p>
<p><strong>Improving the Icon Display; </strong></p>
<p>In the original post, I put forward the following code for adding link icons;<span id="more-173"></span></p>
<blockquote><p> <code>a[href$='.pdf'] {<br />
display:inline-block;<br />
padding-left:20px;<br />
line-height:18px;<br />
background:transparent url(Images/PDFIcon.gif) center left no-repeat;<br />
}</code></p></blockquote>
<p>The code is ok, but it&#8217;s a little temprimental when you come to using it on small fonts.  It seems that setting a line-height property just doesn&#8217;t cut it where most browsers are concerned, and your icons can get cropped if they&#8217;re bigger than the height of your characters.   Let&#8217;s adjust this a bit, to ensure that we don&#8217;t have our icons cropped by the line-heights&#8230;</p>
<blockquote><p><code>a[href$='.pdf'] {<br />
display:inline-block;<br />
<strong>   padding:2px 0px 2px 20px;</strong><br />
line-height:18px;<br />
<strong>   min-height:18px;<br />
overflow:visible;</strong><br />
background:transparent url(Images/PDFIcon.gif) center left no-repeat;<br />
}</code></p></blockquote>
<p>That&#8217;s much more cross-browser consistant, although it&#8217;s one that might need a little tweaking, depending on your overall layout.</p>
<p><strong>Dealing with incompatible browsers;</strong></p>
<p>There&#8217;s not much CSS can do on its&#8217; own for the browsers that don&#8217;t understand it.</p>
<p>And that, in itself, is part of the beauty of this method.  Quite unusually for CSS, if something in this example is incompatible with the browser, its&#8217; unlikely to throw other things out of alignment.  <em>However,</em> help is there for those with diligence.  You can quite easily expand your selectors to include a class, so that icons can be manually applied (or un-applied) to links.  Thus;</p>
<blockquote><p><code>a[href$='.pdf']<strong>, .pdflink</strong> {<br />
display:inline-block;<br />
padding:2px 0px 2px 20px;<br />
line-height:18px;<br />
min-height:18px;<br />
overflow:visible;<br />
background:transparent url(Images/PDFIcon.gif) center left no-repeat;<br />
}</code></p></blockquote>
<p>There are other ways than just CSS, however.  Check out this post by Rebecca Murphey, <a href="http://blog.rebeccamurphey.com/2008/01/06/unobtrusive-cross-browser-add-filetype-icon-link-javascript-jquery/#comment-36" title="Open link in a new window" target="_blank">&#8220;Unobtrusive, cross-browser method to add icons to links&#8221;</a> &#8211; using javascript to get the same end-result.</p>
<p><strong>More than just file types;</strong></p>
<p>Why stop at file types?  A pet peeve of mine is not being able to anticipate browser behaviour once I click a link. Will I get a new window?  Won&#8217;t I?  In the first version of this post, we touched on wikipedia-style external link signifiers.  So let&#8217;s expand this to react to the target attributes of links.</p>
<blockquote><p><code>a<strong>[target='_blank']</strong> {<br />
display:inline-block;<br />
padding:2px 20px 2px 0px;<br />
line-height:18px;<br />
min-height:18px;<br />
overflow:visible;</code><br />
<code> background:transparent url(Images/NewWindowIcon.gif) center right no-repeat;<br />
}</code></p></blockquote>
<blockquote>
<blockquote></blockquote>
</blockquote>
<p><strong>More than just link targets;</strong></p>
<p>Talking of wikipedia, wouldn&#8217;t it be useful to include a little more context to your links?  There&#8217;s personal blogs, there&#8217;s company websites, reference sites and there&#8217;s search engines.  If you&#8217;re linking to an article at wikipedia the information is likely to be a very different style to a personal blog.  And both those articles are going to be directly more useful than a page of search results.  So why not include the target websites&#8217; logo?  Or perhaps come up with some generic &#8216;classification&#8217; icons to accompany your links? A collection of the favicons of several core websites could be a good idea.  But then it could get out of hand.</p>
<p>Anyway, this technique would be little different than that for &#8216;absolute&#8217; links, except that we are specifying more of the complete url;</p>
<blockquote><p><code>a[href^="http://<strong>en.wikipedia</strong>"] {<br />
display:inline-block;<br />
padding:2px 20px 2px 0px;<br />
line-height:18px;<br />
min-height:18px;<br />
overflow:visible;</code><br />
<code> background:transparent url(Images/WikiIcon.gif) center right no-repeat;</code><br />
}</p></blockquote>
<p>What you include special icons for is up to you.  Wikipedia is an obvious choice, and so are the most visited sites, like search engines, social network sites, online shops, and journals.  This idea requires hard graft rather than offering a unilateral CSS solution.  I suggest picking the sites important to your website and going with them.  You&#8217;ve got some decision making to do on this one. I&#8217;d love to be able to autogenerate urls based on the link attributes but &#8211; so far as I can tell &#8211; that&#8217;s beyond CSS at the moment.  Perhaps this calls for some server scripting?</p>
<p><strong>More than networking;</strong></p>
<p>What else is there?  Well, we haven&#8217;t even looked at <a href="http://microformats.org" title="Open link in a new window" target="_blank">Microformats</a> or &#8216;<em>rel</em>&#8216; attributes yet.  True, some things like rel-nofollow can be utterly useless to the user, but <em>hCard </em>links can be.  Then there&#8217;s trackback links, bookmarks, rss feeds, practically anything.  The format is all pretty similar;</p>
<blockquote><p><code>a<strong>[rel='bookmark']</strong> {<br />
display:inline-block;<br />
padding:2px 20px 2px 0px;<br />
line-height:18px;<br />
min-height:18px;<br />
overflow:visible;</code><br />
<code> background:transparent url(Images/BookmarkIcon.gif) center right no-repeat;<br />
}</code></p></blockquote>
<p><strong>Putting it all together; </strong></p>
<p>One of the difficult things about CSS when you&#8217;re doing this, is working out the inheritance models for your links.  Things at the end of your CSS file will override those at the top, so be wary how you organise your links.  This is unfortunately the point where you can come up against the brick wall that is the limitations of CSS.  Sofar as I know, there&#8217;s no way of using multiple selectors &#8211; say for instance, external links <em>and</em> new windows &#8211; it&#8217;s a case of either-or.</p>
<p><strong>External links / More&#8230;</strong></p>
<p>Since I started writing this post, I&#8217;ve found a few other good examples online &#8211; none of which I knew about before I started (darn!)</p>
<ul>
<li>Alexander Kaiser has a similar implimentation to what I&#8217;ve mentioned here, but with working examples and a downloadable version.  Have a look at <a href="http://pooliestudios.com/projects/iconize/" title="Open link in a new window" target="_blank">&#8220;Iconize Textlinks with CSS.&#8221;</a></li>
<li>The CSS Guy kickstarted this idea a while ago, with his post <a href="http://www.askthecssguy.com/2006/12/showing_hyperlink_cues_with_cs_1.html" title="Open link in a new window" target="_blank">&#8220;Showing Hyperlink Cues with CSS&#8221;</a></li>
<li>And Rebecca Murphey has an example of achieving the same effect using javascript with her post, <a href="http://blog.rebeccamurphey.com/2008/01/06/unobtrusive-cross-browser-add-filetype-icon-link-javascript-jquery/#comment-36" title="Open link in a new window" target="_blank">&#8220;Unobtrusive, cross-browser method to add icons to links&#8221;</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/css/automatic-link-icons-v20.htm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Displaying Link locations with CSS</title>
		<link>http://www.psyked.co.uk/css/displaying-link-locations-with-css.htm</link>
		<comments>http://www.psyked.co.uk/css/displaying-link-locations-with-css.htm#comments</comments>
		<pubDate>Tue, 27 Nov 2007 08:01:15 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[A List Apart]]></category>
		<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://h3Whywouldyouwanttoo?/h3Howoftenisitthecasethatyou&#039;renotemquite/emsurewherealinkisgoingtotakeyou?Ok,soit&#039;snotamajorissueformainstreambrowsers-afterall,that&#039;swhattheStatusbarisfor.Butbeyondyourn</guid>
		<description><![CDATA[Why would you want too? How often is it the case that you&#8217;re not quite sure where a link is going to take you? Ok, so it&#8217;s not a major issue for mainstream browsers &#8211; after all, that&#8217;s what the &#8220;Status bar&#8221; is for. But beyond your normal browser operation &#8211; say on an unusual [...]]]></description>
			<content:encoded><![CDATA[<h3>Why would you want too?</h3>
<p>How often is it the case that you&#8217;re not <em>quite</em> sure where a link is going to take you?  Ok, so it&#8217;s not a major issue for mainstream browsers &#8211; after all, that&#8217;s what the &#8220;Status bar&#8221; is for.  But beyond your normal browser operation &#8211; say on an unusual machine or if you&#8217;re looking at a print-off &#8211; just how can you tell where a link should be going?  If the link text is good, you might be able to track down the target page, but that&#8217;s nothing compared to the usefullness of a full URL.</p>
<p>Luckily with a smidgen of CSS and an up-to-date browser, you can solve at least a few of these problems in a nice, clever way.  A List Apart covered this in the misty old era of 2002, back when I was still making HTML pages with notepad and cobbling together images with Trial versions of Paint Shop Pro.  In the article, <a href="http://www.alistapart.com/articles/goingtoprint/" title="Open link in a new window" target="_blank">CSS Design: Going to Print</a>, they Eric Meyer covers &#8211; amongst other things &#8211; the issue of displaying &#8216;Printed links&#8217;, making links that are as useful in print as they are functional onscreen.<span id="more-161"></span></p>
<h3>What do I have to do?</h3>
<p>The long and short of it is this snippet of code;</p>
<p><code>#content a:link:after, #content a:visited:after {<br />
content: " (" attr(href) ") ";<br />
font-size: 90%;<br />
}</code></p>
<h3>How does it work?</h3>
<p>Well, the &#8216;:after&#8217; selectors are pseudo-selectors under the CSS 2.1 spec, and can add styles to an imaginary object that is created after the chosen item.  In this case, it&#8217;s doubled up with the &#8216;content:&#8217; property, one that can generate basic text.  This is really the usage that the &#8216;:before&#8217;, &#8216;:after&#8217; and &#8216;content:&#8217; properties / selectors were invented for.</p>
<p>Following the &#8216;content:&#8217; property is a bit of calculation &#8211; about as complex as CSS calculations can get &#8211; and is effectively adding two strings and a property together to generate the content. The &#8216;attr(href) &#8216; is dynamically pulls in the href attribute of the selected HTML object.  It could pretty much be used on any attribute, though.</p>
<p>What&#8217;s the final result?  That&#8217;s simple.  Any links in the #content element of the page will automatically have their href / url displayed as text after the link itself.  That way you can easily see where they go, without relying on things like the status bar.  Especially useful if you&#8217;re creating printable version of pages, because of how seemlessly it will display.</p>
<p>It seems curious that I haven&#8217;t seen this in action much &#8211; presumably because the article was so old before the major browsers caught up with the CSS 2 specs.  Who knows?</p>
<h3>In action&#8230;</h3>
<p>Nick La, over at <a href="http://www.webdesignerwall.com/" title="Open link in a new window" target="_blank">Web Designer Wall</a>, uses a very similar technique for the comments section of his website.  When you roll over the commenters&#8217; name, it displays &#8211; in plain text &#8211; the url associated with that commenter.  This is however, done without this method, in favor of what I assume to be a nice cunning bit of &#8216;:hover&#8217; pseudoclasses and &#8216;display:&#8217; properties.  It just goes to show that this idea doesn&#8217;t have to be limited to print stylesheets.</p>
<p><span class="update">There is now an example using this technique to display email address locations at <a href="http://css-tricks.com/better-email-links-featuring-css-attribute-selectors/">http://css-tricks.com/better-email-links-featuring-css-attribute-selectors/</a>.  Check it out!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psyked.co.uk/css/displaying-link-locations-with-css.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/31 queries in 0.024 seconds using disk: basic
Object Caching 735/783 objects using disk: basic

Served from: www.psyked.co.uk @ 2012-02-04 04:29:18 -->
