<?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>Web Design &#38; Development Talk &#187; css</title>
	<atom:link href="http://www.web-design-talk.co.uk/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-design-talk.co.uk</link>
	<description>Web Design &#38; Development Blog</description>
	<lastBuildDate>Thu, 29 Dec 2011 15:34:21 +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>Object Oriented CSS (OOCSS) &#8211; My View</title>
		<link>http://www.web-design-talk.co.uk/447/object-orientated-css-oocss/</link>
		<comments>http://www.web-design-talk.co.uk/447/object-orientated-css-oocss/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 15:34:21 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=447</guid>
		<description><![CDATA[After reading an article about OOCSS (Object Oriented CSS) I was left a little numb and confused to be honest. I&#8217;d advise you read the full article before reading what follows. The idea is fairly simple &#8211; write your CSS using a &#8220;bottom up&#8221; approach, as opposed to a &#8220;top down&#8221; approach, treating your elements [...]]]></description>
			<content:encoded><![CDATA[<p>After reading an article about <abbr title="Object Oriented CSS">OOCSS</abbr> (Object Oriented CSS) I was left a little numb and confused to be honest. I&#8217;d advise you <a href="http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/" target="_blank">read the full article</a> before reading what follows.</p>
<p>The idea is fairly simple &#8211; write your <abbr title="Cascading Styles Sheets">CSS</abbr> using a &#8220;bottom up&#8221; approach, as opposed to a &#8220;top down&#8221; approach, treating your elements as &#8220;objects&#8221;, using mainly classes, as opposed to IDs. The idea of this is to make classes more reusable and to encourage a greater css granularity architecture. The overall theory behind OOCSS is something I don&#8217;t dispute in the least, if anything it&#8217;s simply good practice when writing a CSS file.</p>
<p>For me, the whole article borders on the pedantic to the outright pretentious.</p>
<p>Firstly, I&#8217;m not a fan of the name. &#8220;OOCSS&#8221; implies a link to OOP (Object Orientated Programming), which it is not. I can see why they&#8217;ve named it OOCSS as I guess multiple classes could be similar to inheritance, an element on your page as an &#8220;object&#8221;, classes imply reusability etc. As a web developer, who uses OOP I was instantly put on the defensive, thinking &#8220;OOP for CSS, wtf&#8221;. I understand the name is simply a paradigm, but it sends out all the wrong signals for me personally.</p>
<p>Apologies if this article turns into a bit of a rant&#8230;..</p>
<p><span id="more-447"></span></p>
<h2>Descendant CSS Selectors</h2>
<p>OOCSS seems to have a odd rule whereby descendant CSS selectors (E&gt;g. .foo h4) are suddenly not allowed. Instead, to adhere to OOCSS principals you need to split the this into two separate classes and apply both classes within your HTML code:</p>
<pre class="brush: xml; title: ; notranslate">&lt;div class=&quot;button-basic button-skin&quot;&gt;&lt;/div&gt;</pre>
<p>Both methods &#8211; using a descendant selector and two classes &#8211; are perfectly valid for me.</p>
<h2>CSS Class Abstraction</h2>
<p>One of the ideas that I don&#8217;t agree with the fact that the article and whole concept implies that more class abstraction is good. People still learning could read into this idea the wrong way and (worse case scenario) end up with a plethora of abstract classes that produces some awful HTML:</p>
<pre class="brush: xml; title: ; notranslate">&lt;div class=&quot;padding center-element block text-italic floated-right&quot;&gt;&lt;/div&gt;</pre>
<p>I won&#8217;t go into the debate about speed of selectors either, as the article is little one sided here. Giving preference the use of classes over IDs is not a good way to go in my opinion.</p>
<h2>OOCSS Performance Benefits</h2>
<p>Another major selling point of OOCSS is that of site speed &#8211; which is of huge concern to web developers nowadays after recent Google changes, citing page speed as ranking factor. This part of the article is null and void for me as it&#8217;s so obvious. Small style sheets will result in smaller css files that download faster &#8211; that&#8217;s pretty obvious. Although after the CSS file has been gzipped there wouldn&#8217;t be a great deal of real world benefit. Saying all that however, OOCSS is something the majority of good developers do anyway &#8230;.</p>
<h2>OOCSS &#8211; Already Used &#8230;</h2>
<p>For me, OOCSS is an acronym someone has given to a technique they have suddenly realised they use, after comparing it to OOP &#8211; a fancy name if you like. It&#8217;s an acronym I imagine will be very common on CVs.</p>
<p>After reading the article I wondered why it existed in the first place. OOCSS is something any designer/developer worth their salts does by default after a longer enough period of time. One of the biggest sayings when relating to good CSS is &#8220;don&#8217;t use ID selectors for everything&#8221;. It doesn&#8217;t make a great deal of sense when you&#8217;re learning, but as time goes on you&#8217;ll realise that some commonly used IDs could just as well be a class &#8211; whallah, you have yourself the beginning of OOCSS. For instance, in pretty much all my projects I have a class called input-wide that one applied to an input field, makes it longer.</p>
<p>Hell, when I was first learning CSS years ago and ran my (awful, naff) sites through the <a href="http://jigsaw.w3.org/css-validator/" target="_blank">W3C CSS Validator</a> popped up a warning mentioning redundant CSS that could be better served using a class instead of ID &#8211; I never heard one mention of OOCSS then either.</p>
<p>To conclude, I&#8217;m not against OOCSS per se, I&#8217;m against the way it&#8217;s been described in the article as something new and revolutionary. In reality, everyone uses it, unknowingly as it&#8217;s simply a collection of best practices. The article would have a made a lot more sense if it was titled something along the lines of &#8220;CSS Best Practices&#8221;, as that&#8217;s simply what it describes, nothing more or less.</p>
<p>For me this whole area complicates CSS. Personally, I&#8217;ll keep using <a href="http://lessframework.com/" target="_blank">LESS</a> for rapid development of layouts on multiple devices and as a starting point for my CSS &#8211; which is just what I believe a CSS Framework should be &#8211; a starting point, not a long list of &#8220;do&#8217;s and dont&#8217;s&#8221;</p>
<p>I&#8217;m sure some people will totally disagree with me on this whole topic, so I apologise in advance. At the end of the day it&#8217;s a hugely subjective topic <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/447/object-orientated-css-oocss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ECommerce Content Source Ordering for Product Detail Pages</title>
		<link>http://www.web-design-talk.co.uk/326/ecommerce-content-source-ordering-for-product-detail-pages/</link>
		<comments>http://www.web-design-talk.co.uk/326/ecommerce-content-source-ordering-for-product-detail-pages/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 19:07:37 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CRO]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[google analytics]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[xHTML]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=326</guid>
		<description><![CDATA[Content source ordering or SOC (source ordered content) is the idea that content nearer the top of the raw  HTML source code has greater weight and meaning for search engines. For instance, a paragraph of text right at the top of the HTML source has more meaning than the same passage that may appear in [...]]]></description>
			<content:encoded><![CDATA[<p>Content source ordering or SOC (source ordered content) is the idea that content nearer the top of the raw  HTML source code has greater weight and meaning for search engines. For instance, a paragraph of text right at the top of the HTML source has more meaning than the same passage that may appear in the footer. It is very useful for those all too common generic menus (home, about, contact etc.) that has no SEO benefit at all, yet appears at the top of every page of your site. With SOC and absolute positioning of DOM elements, it is possible to position this HTML at the very bottom of the source code, thus gicing greater weight to your page content.</p>
<p>The latter is not a new idea by any means, but is generally considored to be a positive practice to implement on any site.</p>
<p><span id="more-326"></span></p>
<h2>SOC and Ecommerce</h2>
<p>The effect is compounded on ecommerce sites &#8211; sites that usually have a heavy template footprint. For example, a typical ecommerce site may contain a category listing with child categories in the form of a &#8220;mega drop down menu&#8221;, as they seem to to be coined. This is fine, as such menus do contain a lot of good keyword rich material that will be relevant to your site.</p>
<p>However, I have recently been experimenting a little on an ecommerce site I regularly perform SEO on, that does have a fairly beefy drop down menu. I have been focusing on product pages &#8211; I like to think of these as your most important pages and pages you&#8217;d want people to land on, as it tends to help conversions. In my eyes, any white hat technique to give greater weight and meaning to such pages is a good thing.</p>
<p>For the site in question I edited the source to force the top menu to the very bottom of the page and used absolute positioniong to force the top menu to the top of the screen for the user, when the page is rendered. I performed a similar action for the product description. As a result the important content i.e. the product title and description are now very close to the top of the page within the HTML.</p>
<h2>Further Product Page Optimisations for SEO</h2>
<p>Additionally I made a couple of other minor optimisations that I&#8217;ve noticed some bigger sites are using. At the top of the site in question, there is a company logo &#8211; a link, styled with a background using css. For the product page I amended this to a h1 tag with the product title within the header tag. I then used text-indent to hide this. Further down the page, I replaced the old header one tag (was further down the page previously, next to the product description) with a h2 tag and placed the product strapline within a h3 tag. So, the HTML for my company logo, for a product page is as follows:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;
&lt;a href=&quot;/product-url.html&quot;&gt;My Product Name Here&lt;/a&gt;
&lt;/h1&gt;
</pre>
<p>I&#8217;ve been runing the above for a month now and have noticed the following trends in Google Analytics &#8211; I can&#8217;t be 100% sure this is directly down to the above though:</p>
<ul>
<li>Increased traffic to product detail pages from Google</li>
<li>1.2% increase in sales conversions</li>
</ul>
<p>Over the next month I&#8217;ll be experimenting with replacing the logo with the category name, on my category listing pages too. I&#8217;ll update this post with my findings.</p>
<p>Have you had any similar experiences using the above, or similar?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/326/ecommerce-content-source-ordering-for-product-detail-pages/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Image Masking with CSS and HTML</title>
		<link>http://www.web-design-talk.co.uk/299/image-masking-with-css-html/</link>
		<comments>http://www.web-design-talk.co.uk/299/image-masking-with-css-html/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 14:55:09 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[xHTML]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=299</guid>
		<description><![CDATA[A recent web design called for the following: the client must be able to upload their own banner images the banner image was not square and had a transparfent mask around over it (in Photoshop, the banner image was underneath a clipping mask) The design must function in a range of legacy browsers This presented [...]]]></description>
			<content:encoded><![CDATA[<p>A recent web design called for the following:</p>
<ul>
<li>the client must be able to upload their own banner images</li>
<li>the banner image was not square and had a transparfent mask around over it (in Photoshop, the banner image was underneath a clipping mask)</li>
<li>The design must function in a range of legacy browsers</li>
</ul>
<p>This presented a major headache. Usually uplaoding a totally square image is easy &#8211; a client can do this with ease themselves. However, the client in question has no experience using using Photoshop (and why should they to update their website?) and wouldn&#8217;t be able to upload a masked image. Additionally, using some of the new <a href="http://www.webkit.org/blog/181/css-masks/" target="_blank">CSS3 image masking properties</a> are out, as I need to support IE6 and above.</p>
<p>So, the solution here is to use a transparent image to overlay the square image &#8211; meaning a client can upload a square image and have it show masked on the live website &#8211; see the <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/10/static/index.php" target="_blank">final result</a> of what we&#8217;ll be making.</p>
<p><span id="more-299"></span></p>
<p>The HTML is quite simple:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;banner_outer&quot;&gt;

    &lt;div id=&quot;banner&quot;&gt;
        &lt;div class=&quot;frame_top&quot;&gt;&lt;/div&gt;
        &lt;div class=&quot;frame_bottom&quot;&gt;&lt;/div&gt;
        &lt;img src=&quot;images/banners/splat.jpg&quot; alt=&quot;splat&quot; /&gt;
    &lt;/div&gt;

&lt;/div&gt;
</pre>
<p>Here, we have a simple wrapping divider to center the banner &#8211; &#8220;banner_outer&#8221; and a second divider to hold the banner &#8211; &#8220;banner&#8221;. There are also two dviders that are absolutely positioned, using a <a href="http://www.web-design-talk.co.uk/88/css-sprities-and-website-optimization/" target="_blank">css sprites</a> for the background images. The image is a 24 Bit PNG image &#8211; as this gives the smoothest effect for the frame and the underlying images could be photographs.</p>
<p>Remove the two frame dividers you&#8217;ll get a a simple box with a square image. However, when you add the two frame dividers you&#8217;ll see the image is show framed (one frame at the top, one at the bottom), exactly how an image clip would work in Photoshop. The CSS is very simple, but there is one key here to make your life easier and to ensure cross browser compatibility.</p>
<h2>Positioning for Child and Parent Elements</h2>
<p>Postion the parent divider to the two frames relatively. Why do this? Well a DOM element <strong>positioned relatively</strong>, gives you full control of the <strong>child DOM elements</strong> inside it, using absolute positioning &#8211; this was definately one of those &#8216;a-ha!&#8217; moments for me where everything became clear.</p>
<p>In essence, the latter stops <strong>child elements</strong> positioned absolutely, from positioning themselves in relation to the body. To see the effect in action, <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/10/static/index.php" target="_blank">view the demo</a> and use <a href="http://getfirebug.com/" target="_blank">Firebug</a> to disable the &#8216;position: relative&#8217; on the #banner element &#8211; the two frames are positioned absolutely according to the body element and not the #banner element as we want. You <em>could </em>ignore the position relative for the parent item, position the frame divs abolsutely and use margins to move them about &#8211; -this will work but you&#8217;ll run into issues in IE. I&#8217;d highly abvise you stick to the position <strong>relative method</strong>, as described above.<em> </em></p>
<p>The frame I&#8217;ve chosen is a very subtle curve, but you could use any type of shape the mask the image.</p>
<h3>A Note on IE6</h3>
<p>As I&#8217;m sure many of you have already rightly realised &#8211; IE6 does not support transparent PNGs. This is really the only downside to this <strong>css based image masking</strong> technique. There are an absolute plethora of hacks for this, but I&#8217;ll be using the <a href="http://www.dillerdesign.com/experiment/DD_belatedPNG/" target="_blank">belated IE6 PNG Fix</a> &#8211; which adds PNG support to IE6 and below. All that is required is the the following is added the head tag:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if lt IE 7]&gt;
    &lt;script src=&quot;js/IE_PNG.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script&gt;DD_belatedPNG.fix('div');&lt;/script&gt;
&lt;![endif]--&gt;
</pre>
<p>The CSS for the example in question is extremely simple &#8211; there&#8217;s no need for me to explain this. Only difference, is that I&#8217;ve added a splash of CSS3 for eye candy.</p>
<p>The final result using a single image can be seen <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/10/static/index.php" target="_blank">here</a> and a result with multiple images using the excellent innerfade plugin can be seen <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/10/innerfade/index.php">here</a>.</p>
<p>Happy image masking! <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/299/image-masking-with-css-html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create A Slick Image Portfolio Effect</title>
		<link>http://www.web-design-talk.co.uk/291/slick-portfolio-opacity-effect/</link>
		<comments>http://www.web-design-talk.co.uk/291/slick-portfolio-opacity-effect/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 16:18:37 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xHTML]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=291</guid>
		<description><![CDATA[I was recently browsing a few photography website and came across a quite slick way to display a small snippet of information for for an image gallery. Unfortunately, it was Flash based, so I attemtpted to mimick the using only xHTML and CSS. The basic xHTML is as follows: The HTML is simply an unordered [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.web-design-talk.co.uk/wp-content/uploads/2011/03/html-css-image-gallery.jpg" ><img class="alignleft size-full wp-image-292" title="html-css-image-gallery" src="http://www.web-design-talk.co.uk/wp-content/uploads/2011/03/html-css-image-gallery.jpg" alt="html css image hover effect gallery" width="604" height="198" style="border:1px solid #bbb;padding:2px;" /></a></p>
<p>I was recently browsing a few photography website and came across a quite slick way to display a small snippet of information for for an image gallery. Unfortunately, it was Flash based, so I attemtpted to mimick the using only xHTML and CSS.</p>
<p><span id="more-291"></span></p>
<p>The basic xHTML is as follows:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul class=&quot;gallery&quot;&gt;
	&lt;li&gt;
&lt;div class=&quot;image_holder&quot;&gt;&lt;img src=&quot;images/1.png&quot; alt=&quot;some image&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;detail&quot;&gt;

ImageTitle

{YOUR SNIPPET TEXT}

      &lt;a class=&quot;more button&quot; href=&quot;#detail_link&quot;&gt;View More&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>The HTML is simply an unordered list, with a detail div, absolutely positioned, that contains the popup information about that item. When a user hovers over an image the detail tab will be shown. To achieve this effect a simple bit of CSS is used:</p>
<pre class="brush: css; title: ; notranslate">
ul.gallery li:hover .detail {
   display: block;
}
</pre>
<p>There&#8217;s not a lot more to be honest &#8211; take a look at the <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/9/index.php">result</a> or <a rel="nofollow" href="http://www.web-design-talk.co.uk/examples/9/9.zip">download the source files</a>.</p>
<p>The only downside is that due to the selectors used, the information divider fails to show in IE6.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/291/slick-portfolio-opacity-effect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a CSS Hover Effect Image Gallery</title>
		<link>http://www.web-design-talk.co.uk/230/css-hover-effect-image-gallery/</link>
		<comments>http://www.web-design-talk.co.uk/230/css-hover-effect-image-gallery/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 18:18:24 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=230</guid>
		<description><![CDATA[After browsing through a a few web portfolios lately I&#8217;ve noticed a rather noce efefct &#8211; whereby when the user hovers over a thumbnail an image appear &#8211; this may be a zoom icon (for images) or a play button (for videos). In thus article I&#8217;ll quickly run through the simple steps on who we [...]]]></description>
			<content:encoded><![CDATA[<p>After browsing through a a few web portfolios lately I&#8217;ve noticed a rather noce efefct &#8211; whereby when the user hovers over a thumbnail an image appear &#8211; this may be a zoom icon (for images) or a play button (for videos). In thus article I&#8217;ll quickly run through the simple steps on who we create a a funky <a href="http://www.web-design-talk.co.uk/examples/css-hover-effect-gallery/">css hover effect image gallery</a>. This is a very useful technique for any sort of site that display thumbnails links.</p>
<h3 style="font-size: 14px;">The HTML</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;thumb_wrap&quot;&gt;
&lt;a href=&quot;#link&quot; class=&quot;thumb_link&quot;&gt;
&lt;span&gt;&lt;img src=&quot;play.png&quot; alt=&quot;play&quot; class=&quot;play_video&quot; /&gt;&lt;/span&gt;
&lt;img src=&quot;thumb.jpg&quot; alt=&quot;thumbnail&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>I&#8217;ve simply nested a span tag containing the hidden play button. Additionally, to keep everything XHTML valid, the hyperlink doesn;t contain block level elemnts.</p>
<h3 style="font-size: 14px;">The CSS</h3>
<pre class="brush: css; title: ; notranslate">
a img {
border:none;
}

.thumb_wrap {
width:194px;
height:110px;
margin:0 25px 0 0;
float:left;
}

img.play_video {
position: absolute;
margin:40px 0 0 80px;
display: none;}
</pre>
<p>The CSS is simply sets the image&#8217;s position absolutely (to ensure nothing gets pushed out of line).</p>
<h3 style="font-size: 14px;">The JQuery</h3>
<p>The give the show effect a nice fade in style and in order the show our hidden image I&#8217;ll add a small piece of JQuery that finds the image within our span tag and fades it in. The latter is done when the user hovers over the image, when the mouse leaves, the image is hidden again. The folllwing would go within the head tag (I&#8217;ve also<a href="http://www.web-design-talk.co.uk/81/reasons-to-let-google-host-your-jquery-files/"> let Google CDN host my JQuery file</a>):</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {

$(&quot;.thumb_link&quot;).mouseover(function(){
 $(this).find('img.play_video').fadeIn('slow');
});

$(&quot;.thumb_link&quot;).mouseout(function(){
 $(this).find('img.play_video').hide();
});

});
&lt;/script&gt;
</pre>
<p>&#8230;..and that&#8217;s it. You now have a cross browser compatible (IE 6 plus) image gallery effect, that is very easy to implement. See the<a href="http://www.web-design-talk.co.uk/examples/css-hover-effect-gallery/"> image gallery in action</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/230/css-hover-effect-image-gallery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS Sprities and Website Optimization</title>
		<link>http://www.web-design-talk.co.uk/88/css-sprities-and-website-optimization/</link>
		<comments>http://www.web-design-talk.co.uk/88/css-sprities-and-website-optimization/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 21:10:19 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[sprities]]></category>
		<category><![CDATA[website optimisation]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=88</guid>
		<description><![CDATA[One of the latest and most well established design practices are CSS sprites. This is the practice of combing multiple images into a larger and single, composite image. By using the CSS background-position property selected portions of that master image (or sprite) are displayed. The main issue here is how can a larger image witha [...]]]></description>
			<content:encoded><![CDATA[<p>One of the latest and most well established design practices are CSS sprites. This is the practice of combing multiple images into a larger and single, composite image. By using the <a href="http://www.w3schools.com/css/pr_background-position.asp">CSS background-position property</a> selected portions of that master image (or sprite) are displayed. The main issue here is how can a larger image witha larger file size be beneficial, especially when compared to several smaller images? The answer lies in HTTP requests and <a href="http://yuiblog.com/blog/2006/11/28/performance-research-part-1/">Yahoo&#8217;s 80/20 rule</a> explains this much better than I could! To summarise, the numbers of HTTP requests to the websites is drastically cut, thus loading the page much faster in  single request. Another major beenfit is that not Javascript is required for mouseover code, so you can make image rollovers easily. I have used this technque in the past, but like a lot of people never knew it was called sprites.</p>
<p>In fact, using sprites are so effective many of the internets biggest site&#8217;s are using them, all in slightly different ways. On such sites a truely huge number of requests are saved every day. For example, Youtube, Google, AOL,  Amazon and Apple all use CSS sprites. Take the mimilist example of Google (left):</p>
<div class="wp-caption alignleft" style="width: 160px"><img title="Google CSS Sprite" src="http://www.google.ca/images/nav_logo3.png" alt="Google CSS Sprite" width="150" height="105" /><p class="wp-caption-text">Google CSS Sprite</p></div>
<p>Youtube, does things slightly different and uses a absolutely <a href="http://s.ytimg.com/yt/img/master-vfl89407.png">massive sprite 2800px in height</a>! You&#8217;ll notice that some sprites are tightly packed together and other have spacing around each image. This is to allow for browser based text sizing, that would otherwise display multiple background images. A good example of planning for such an occurance is <a href="http://digg.com//img/menu-current.gif">Digg&#8217;s sprite</a>, where each image is highly spaced out.</p>
<p>The CSS is relatively simple. Take the example of a simple unordered list with a different image for each item. I made a <a href="http://web-design-talk.co.uk/examples/3/yada.png">very simple sprite </a>and applied the background-position property to each link class. Here&#8217;s the simple HTML used for the list:<span id="more-88"></span></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul id=&quot;sprites&quot;&gt;
	&lt;li&gt;&lt;a class=&quot;exclamation&quot; href=&quot;#&quot;&gt;Top Product&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a class=&quot;hot&quot; href=&quot;#&quot;&gt;Sizzlin Offers&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a class=&quot;offer&quot; href=&quot;#&quot;&gt;Special Deals&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>..and the CSS:</p>
<pre class="brush: css; title: ; notranslate">#sprites li {
 	list-style-type:none;
	font-size:1.1em;
	display: inline;
}
#sprites li a {
	background-image:url('yada.png');
	background-repeat:no-repeat;
	padding:5px 35px;
	line-height:35px;
	text-decoration: none;
	color: #333;
}
#sprites li a:hover {
text-decoration: underline
}
#sprites li a.hot {background-position:0px -165px}
#sprites li a.exclamation { background-position: 0px 0px; }
#sprites li a.offer { background-position: 0 -82px; }</pre>
<p>The <a href="http://web-design-talk.co.uk/examples/3/">final result</a> is a horizontal list, using a single image for the icons &#8211; no CSS hacks required for correct display in all the latest browsers! I won&#8217;t bother explaing the HTML or CSS as is self explanatory and very simple.</p>
<p>I personally find CSS sprites most useful for application icons as I can easily add a new icon class and set the background position accordingly. For instance, I&#8217;m currently working on a project that uses a lot of the fabulous <a href="http://www.famfamfam.com/lab/icons/silk/">famfamfam silk icons</a> and have used a <a href="http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png">sprite similar to that on their site</a>. While this is a lot of work initially, my recent discovery the <a href="http://spritegen.website-performance.org/">sprite generator</a> has limited this work load.</p>
<p>Sprites can be used a for avriety of things, including simple image rollovers &#8211; see a quick example I put together using a simple hyperlink and a single background image (image from <a href="http://michaelmknight.deviantart.com/art/Virus-Shield-59357349">devianrt</a>). When I hover on the logo the background-position property simply shifts the spirite to right. You can view the <a href="http://web-design-talk.co.uk/examples/3/css-sprite-single-image.php">result right here</a>!</p>
<p>As with everything, you can take this idea a stage further and apply some JQuery to the mix to <a href="http://www.alistapart.com/articles/sprites2">create an amazing Flash like menu</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/88/css-sprities-and-website-optimization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

