<?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>Inspect Element &#187; images</title>
	<atom:link href="http://inspectelement.com/tag/images/feed/" rel="self" type="application/rss+xml" />
	<link>http://inspectelement.com</link>
	<description>Web Design &#38; Development Blog</description>
	<lastBuildDate>Tue, 07 Feb 2012 14:31:58 +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>Create a CSS3 Image Gallery with a 3D Lightbox Animation</title>
		<link>http://inspectelement.com/tutorials/create-a-css3-image-gallery-with-a-3d-lightbox-animation/</link>
		<comments>http://inspectelement.com/tutorials/create-a-css3-image-gallery-with-a-3d-lightbox-animation/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 13:20:13 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=7617</guid>
		<description><![CDATA[For the most part, the CSS3 tutorials and examples out there are a little dull. Of course there are some really great examples out there such as Benjamin de Cock&#8217;s CSS Playground but most others consist of a drop-shadow here and a few rounded corners there and nothing more. It&#8217;s time to start doing something [...]]]></description>
			<content:encoded><![CDATA[<p>For the most part, the CSS3 tutorials and examples out there are a little dull. Of course there are some really great examples out there such as <a href="http://playground.deaxon.com/css/">Benjamin de Cock&#8217;s CSS Playground</a> but most others consist of a drop-shadow here and a few rounded corners there and nothing more. It&#8217;s time to start doing something more inspirational and useful at the same time.</p>
<p><img class="alignnone size-full wp-image-7637" title="3dgallery" src="http://inspectelement.com/wp-content/uploads/2011/04/3dgallery.jpg" alt="" width="645" height="452" /><br />
<span id="more-7617"></span></p>
<p>Having been inspired to get &#8216;<a href="http://hardboiledwebdesign.com/">Hardboiled</a>&#8216;, I&#8217;ve started playing around with a few cool techniques and exploring how to make the content accessible in less capable browsers while giving the best possible experiences to the ones that support the latest advancements in CSS. I&#8217;ve taken Benjamin&#8217;s CSS lightbox gallery and built upon by adding a few hover effects for the gallery grid itself and a 3D rotation for the lightbox content, all with the use of CSS.</p>
<p><a href="http://inspectelement.com/demos/css3/3dgallery/">View Demo</a></p>
<p><a href="http://inspectelement.com/demos/css3/3dgallery/"><img class="alignnone size-full wp-image-7640" title="3drotate" src="http://inspectelement.com/wp-content/uploads/2011/04/3drotate.jpg" alt="" width="645" height="365" /></a></p>
<h3>The :target Pseudo-Class</h3>
<p>First, let&#8217;s look at how the lightbox actually appears without JavaScript and only CSS with the use of the :target pseudo-class. If you&#8217;re writing CSS, you&#8217;re already using pseudo-classes as you&#8217;ll be familiar with :hover, :visited and :active.</p>
<p>You can link directly to a place on a page by adding a page anchor (#) with the ID of an element to the end of the URL:</p>
<pre><code>http://url.com/#info1</code></pre>
<p>You probably already knew that but what you may not know that you can affect the style of the element that is linked to via the :target pseudo-class. The following code would only be seen if a user clicks on a link with the target ID in:</p>
<pre><code>#info1:target { background-color: red; }</code></pre>
<p>In the case of the demo, we&#8217;re using any list item with an ID that has been &#8216;targeted&#8217; to display the lightbox <code>li[id]:target</code>. Pretty standard CSS is then used to display the lightbox on the page, even with a dark transparent overlay through the use of <code>opacity</code>.</p>
<h3>The Animation</h3>
<p>If we leave it at that, it&#8217;s pretty much the same as a standard lightbox or modal window so we&#8217;ll set it apart with a fun animation. Here is how we&#8217;ve created the animation with the help of keyframes (WebKit only for now):</p>
<pre><code>@-webkit-keyframes lightbox {
	0% { -webkit-transform: scale(5) rotateY(-270deg); }
	100% { -webkit-transform: scale(1) rotateY(0deg); }
}</code></pre>
<p>On it&#8217;s own, the code above won&#8217;t do anything so we need to reference it against the element(s) we want to animate.</p>
<pre><code>li[id]:target div { -webkit-animation: lightbox 0.75s cubic-bezier(0,0,0,1); }</code></pre>
<p>As you can see, the animation is called lightbox and that&#8217;s the first part of the <code>animation</code> property, followed by the duration and the timing function.</p>
<p>It&#8217;s very simple. We&#8217;re telling the div (the white box with the blue heading in the <a href="http://inspectelement.com/demos/css3/3dgallery/">demo</a>) to transform 5 times bigger with <code>scale(5)</code> and from a rotated position of -270 degress with <code>rotateY(-270deg)</code>. Then when the animation ends after 0.75s we want it to reset to it&#8217;s actual size and  rotation. The browser will create the animation in between (which is affected but the cubic-bezier timing function above).</p>
<h3>Less Capable Browsers</h3>
<p>The good thing about this is that browsers that don&#8217;t support CSS3 will fallback to an accessible version without the fancy animations thanks to the use of the page anchor and <a href="http://www.modernizr.com/">Modernizr</a>.</p>
<p><img class="alignnone size-full wp-image-7685" title="simple" src="http://inspectelement.com/wp-content/uploads/2011/04/simple.jpg" alt="" width="645" height="472" /></p>
<p>We do this by testing to see if CSS transforms aren&#8217;t supported and then adding CSS using the <code>.no-csstransforms</code> class. Why are we testing for a lack of CSS transforms and not CSS animation? It&#8217;s mainly to do with <code>:target pseudo-class</code> support which we can&#8217;t test for with Modernizr. It isn&#8217;t supported by older browsers, specifically IE8 and below but it is supported in all browsers with support for CSS transforms (as far as I know).</p>
<p>I&#8217;ve taken that one step further by creating an equal to or less than IE8 condition comment and <code>&lt;noscript&gt;</code> to <em>make sure</em> it is displayed the same in IE without JavaScript.</p>
<pre><code>&lt;!--[if lte IE 8]&gt;
&lt;noscript&gt;
&lt;style&gt;
    #information li { overflow: visible; position: relative; margin: 0 auto; margin-bottom: 25px; background: #fff; width: 600px; padding: 30px; height: auto; list-style: none; }
    #information li div a.close { position: relative; background: transparent; padding: 0; color: #0090e2; font-size: 12px; font-weight: normal; left: 0; top: 0; }
&lt;/style&gt;
&lt;/noscript&gt;
&lt;![endif]--&gt;</code></pre>
<p>We also want to replace the &#8216;x&#8217; (the close button in the lightbox) with &#8216;Back to top&#8217; text for lesser browsers to aid usability. We do that with a bit of jQuery and a test for no CSS transforms with Modernizr.</p>
<pre><code>if (!Modernizr.csstransforms) {
	$(document).ready(function(){
		$(".close").text("Back to top");
	});
}</code></pre>
<h3>Issues</h3>
<p>There are a couple of issues I need to point out:</p>
<ul>
<li>Double scrollbar when the lightbox content exceeds the height of the screen resolution</li>
<li>Animation is possibly slow on older machines (needs more testing)</li>
<li>Loads all content, whereas JavaScript solutions online load content when requested</li>
<li>If a browser has JavaScript turned off and doesn&#8217;t support CSS transforms, no content will be displayed. This is a problem with using Modernizr as a JS solution for browser feature testing.</li>
</ul>
<p>I recommend this should only be considered as a demonstration of CSS3 3D animations unless you don&#8217;t have much content in the lightbox, similar to the <a href="http://inspectelement.com/demos/css3/3dgallery/">demo</a>.</p>
<p>I&#8217;ll be looking to improve it all the time. In the meantime, let me know what you think and if you can offer any improvements or ideas please let me know in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/create-a-css3-image-gallery-with-a-3d-lightbox-animation/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Overlaying Text on Images: What You Need to Consider</title>
		<link>http://inspectelement.com/articles/overlaying-text-on-images-what-you-need-to-consider/</link>
		<comments>http://inspectelement.com/articles/overlaying-text-on-images-what-you-need-to-consider/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 19:32:02 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=3670</guid>
		<description><![CDATA[When overlaying text onto images, the most important thing you need to consider is readability. If the text being placed on top of the image doesn't have enough contrast with the image itself, the message will get lost and frustrate visitors as they try to work out what it actually says. You don't want visitors to have to work hard just to read something on a website. This can contribute to them ignoring the message you want to get across or even cause them to leave the site.]]></description>
			<content:encoded><![CDATA[<p>When overlaying text onto images, the most important thing you need to consider is <strong>readability</strong>. If the text being placed on top of the image doesn&#8217;t have enough contrast with the image itself, the message will get lost and frustrate visitors as they try to work out what it actually says. You don&#8217;t want visitors to have to work hard just to read something on a website. This can contribute to them ignoring the message you want to get across or even cause them to leave the site.</p>
<p><span id="more-3670"></span><strong>What Not to Do</strong></p>
<p>First we need to get an understanding of why this is important. Here are some examples of text being placed on top of images making the text difficult to read.</p>
<p><a href="http://www.knoxville.org/"><img class="alignnone size-full wp-image-4085" title="knoxville" src="http://inspectelement.com/wp-content/uploads/2009/10/knoxville.jpg" alt="knoxville" width="560" height="218" /></a></p>
<p>The combination of the thin typeface, white text and white and light colours in the main image on the <a href="http://www.knoxville.org/">Knoxville Tourism</a> website make it difficult enough to read without having to look closely.</p>
<p><a href="http://elegantresorts.co.uk/"><img class="alignnone size-full wp-image-4130" title="elegantresorts" src="http://inspectelement.com/wp-content/uploads/2009/11/elegantresorts.jpg" alt="elegantresorts" width="560" height="395" /></a></p>
<p>Some of the destinations on the luxurious destinations list on <a href="http://elegantresorts.co.uk/">Elegant Resorts</a> get almost completely lost due to the use of a black and white image with white text. This is especially bad as these are links to elsewhere on the site. If the user can&#8217;t read them, what chance will they click on them?</p>
<p><a href="http://www.australia.com/things_to_do/Food_and_Wine.aspx"><img class="alignnone size-full wp-image-4131" title="australia_foodwine" src="http://inspectelement.com/wp-content/uploads/2009/11/australia_foodwine.jpg" alt="australia_foodwine" width="560" height="180" /></a></p>
<p><a href="http://www.australia.com/things_to_do/Food_and_Wine.aspx">Australia&#8217;s Official Tourism Website</a> use a drop shadow on the text to try and make it more readable but unfortunately the effect is too subtle to be able to read it at a quick glance.</p>
<h3>4 Ways of Making Text on Images More Readable</h3>
<h4>1. Position the Text Appropriately</h4>
<p><a href="http://www.pacificbenefitsgroup.com/"><img class="alignnone size-full wp-image-4165" title="pacificbenefitsgroup" src="http://inspectelement.com/wp-content/uploads/2009/11/pacificbenefitsgroup.jpg" alt="pacificbenefitsgroup" width="560" height="279" /></a></p>
<p>As you can see from the example above on <a href="http://www.pacificbenefitsgroup.com/">Pacific Benefits Group</a>, the white text is placed on top of the darkest part of the image. This makes it easier to read than if it was placed over the sky or over the water.</p>
<h4>2. Increase the Contrast</h4>
<p><a href="http://twittground.com/"><img class="alignnone size-full wp-image-4156" title="tweetground" src="http://inspectelement.com/wp-content/uploads/2009/11/tweetground.jpg" alt="tweetground" width="560" height="131" /></a></p>
<p><a href="http://twittground.com/">Tweetground</a> use a dark coloured text on a light background. This contrast allows the text to be read easily. The obvious ways to increase contrast is to user either dark text on a light background or light text on a dark background. Look back atÂ <a href="http://inspectelement.com/articles/the-principles-of-good-web-design-part-3-colour/">The Principles of Good Web Design Part 3: Colour</a> here on Inspect Element to see more examples of good and bad examples of colour contrast.</p>
<h4>3. Use a Transparent Overlay</h4>
<p><a href="http://www.mcfc.co.uk/"><img class="alignnone size-full wp-image-4152" title="mcfc" src="http://inspectelement.com/wp-content/uploads/2009/11/mcfc.jpg" alt="mcfc" width="560" height="379" /></a></p>
<p>The previous two tips work well for static images and text,Â but what if they are being pulled in separately from a content management system? Here we could get issues where the positioning of the text may not be appropriate to the image. In other words the image and text have not been &#8216;designed&#8217; specifically for readability so you&#8217;ll need some way of keeping the text readable.</p>
<p>As in the example above <a href="http://www.mcfc.co.uk/">Manchester City</a>&#8216;s website, they have used a transparent black layer in between the image and the text. The contrast between the text and image remains at a very readable level no matter what image is used. This transparent layer also allows the image to show through so even though some of the image will be covered you&#8217;re still able to see what is underneath.</p>
<h4>4. Drop Shadow</h4>
<p><a href="http://beakapp.com/"><img class="alignnone size-full wp-image-4179" title="beak" src="http://inspectelement.com/wp-content/uploads/2009/11/beak.jpg" alt="beak" width="560" height="227" /></a></p>
<p><a href="http://beakapp.com/">Beak</a> use drop shadows on the text to give it extra definition against the background image. When used well this is a perfectly acceptable technique but doesn&#8217;t tend to work well on busy images as the shadow gets lost amongst the noise of the image itself. Also, the only way to implement this for use within a CMS is to use CSS3&#8242;s <em>text-shadow </em>property which is only supported by modern browsers and not by any versions of Internet Explorer.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/articles/overlaying-text-on-images-what-you-need-to-consider/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

