<?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>WebDesign &#38; Such &#187; CSS</title>
	<atom:link href="http://webdesignandsuch.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://webdesignandsuch.com</link>
	<description>a Beantown Design Production</description>
	<lastBuildDate>Thu, 29 Jul 2010 00:02:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Target the first paragraph on a page or section with CSS</title>
		<link>http://webdesignandsuch.com/2010/02/target-the-first-paragraph-on-a-page-or-section-with-css/</link>
		<comments>http://webdesignandsuch.com/2010/02/target-the-first-paragraph-on-a-page-or-section-with-css/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 13:40:41 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=732</guid>
		<description><![CDATA[
			
				
			
		

So often I&#8217;ll be working on a website that somebody else coded and have to strip out junk styling. There are a lot of different ways to accomplish the same thing with CSS, but so many people have no idea how much time they are wasting by coding something in a &#8220;hacky&#8221; manner.
Example. I was [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2010%2F02%2Ftarget-the-first-paragraph-on-a-page-or-section-with-css%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2010%2F02%2Ftarget-the-first-paragraph-on-a-page-or-section-with-css%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img class="alignnone" style="border: 3px solid #1e8acf; margin: 0 0 15px 0;" title="CSS child selector" src="http://webdesignandsuch.com/posts/css-child/para.jpg" alt="" width="422" height="211" /></p>
<p>So often I&#8217;ll be working on a website that somebody else coded and have to strip out junk styling. There are a lot of different ways to accomplish the same thing with CSS, but so many people have no idea how much time they are wasting by coding something in a &#8220;hacky&#8221; manner.</p>
<p><strong>Example.</strong><br /> I was working on a site the other day and noticed that every single paragraph in the main content area of every page of the site had a class of &#8220;first-paragraph&#8221; on it. So I looked in the external sheet and saw that this was simply to remove the top margin on the first paragraph on every page. Ok, so that method worked..great. Except that manually adding a class to every paragraph tag is such a waste of time. Check out the demo where I show an example of targeting the first paragraph in a content area without adding any classes or IDs paragraph tag in the XHTML. Then keep reading to see how to properly code the example above.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/css-child/index.html">View Demo</a><br />
<span id="more-732"></span><br />
Here is the code to put in your external CSS sheet to select the first paragraph in a section (in this example a div called &#8220;content&#8221;). In this example I remove the top margin. If the coder in my example above had done this he wouldn&#8217;t have need to add any class to the paragraph tags in the XHTML. Don&#8217;t ya just love CSS?</p>
<div class="codeBox">#content p:first-child {margin-top:0px}</div>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2010/02/target-the-first-paragraph-on-a-page-or-section-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Popup with CSS and Javascript</title>
		<link>http://webdesignandsuch.com/2009/12/how-to-create-a-popup-with-css-and-javascript/</link>
		<comments>http://webdesignandsuch.com/2009/12/how-to-create-a-popup-with-css-and-javascript/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 17:27:23 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Pop Up]]></category>
		<category><![CDATA[Popup]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=709</guid>
		<description><![CDATA[
			
				
			
		

Popups suck.
The good thing is you don&#8217;t see that many of them any more. That&#8217;s because browsers recognize that they suck and are most likely spam or ads and so they block the popups. The old way of creating a popup was to force open a new browser window over the current browser window. So [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F12%2Fhow-to-create-a-popup-with-css-and-javascript%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F12%2Fhow-to-create-a-popup-with-css-and-javascript%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img class="alignnone" style="border: 3px solid #000; margin: 0 0 15px 0;" title="css popup" src="http://webdesignandsuch.com/posts/css-popup/pop.gif" alt="" width="422" height="211" /></p>
<h2 style="margin-bottom:20px">Popups suck.</h2>
<p>The good thing is you don&#8217;t see that many of them any more. That&#8217;s because browsers recognize that they suck and are most likely spam or ads and so they block the popups. The old way of creating a popup was to force open a new browser window over the current browser window. So this is what browsers block. But what if you actually have a need to use a popup window for something useful and not spammy? This happened to me the other day. A client wanted a popup window on their homepage to wish everyone a Merry Christmas.</p>
<p>Knowing I couldn&#8217;t use the old popup method, I went searching. I knew it&#8217;d be easy enough to use CSS to put a floating div over the content of the site, which creates a popup effect. The problem was how do you close the popup once it&#8217;s open? Javascript would be needed for this. Check out the demo I setup which shows how the <strong>CSS popup</strong> can be set to open on <strong>pageload</strong> or by <strong>clicking on a link</strong>; and then how Javascript allows you to have a &#8220;close&#8221; button that shuts or hides the popup. Then continue reading for the code and downloadable files.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/css-popup/css-popup.html">View Demo</a></p>
<p><span id="more-709"></span></p>
<p>If you check out the source code of the html file, you&#8217;ll see the following in the body. The &#8220;<strong>blanket</strong>&#8221; is the effect of putting the transparent black background behind the popup, which helps separate it from the rest of the content on the page. The &#8220;<strong>popUpDiv</strong>&#8221; is where you put the content of your popup.</p>
<div class="codeBox">&lt;div id=&#8221;blanket&#8221; style=&#8221;display:none;&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;popUpDiv&#8221; style=&#8221;display:none;&#8221;&gt;</p>
<p>&lt;a href=&#8221;#&#8221; onclick=&#8221;popup(&#8216;popUpDiv&#8217;)&#8221; &gt;Click to Close CSS Pop Up&lt;/a&gt;<br />
&lt;/div&gt;<br />
&lt;a href=&#8221;#&#8221; onclick=&#8221;popup(&#8216;popUpDiv&#8217;)&#8221;&gt;Click to Open CSS Pop Up&lt;/a&gt;</p>
</div>
<p>If you want the popup to load on <strong>page load</strong>, put the following in your body tag.</p>
<div class="codeBox">&lt;body   onload=&#8221;popup(&#8216;popUpDiv&#8217;)&#8221;&gt;</div>
<p>Here is the CSS used to style the blanket effect and the popup div. You&#8217;ll see I turned the blanket effect off for Internet Explorer, since it doesn&#8217;t appear to support &#8220;opacity&#8221; (big surprise).</p>
<div class="codeBox">#blanket {<br />
background-color:#111;<br />
opacity: 0.65;<br />
*background:none;<br />
position:absolute;<br />
z-index: 9001;<br />
top:0px;<br />
left:0px;<br />
width:100%;<br />
}</p>
<p>#popUpDiv {<br />
position:absolute;<br />
background:url(pop-back.jpg) no-repeat;<br />
width:400px;<br />
height:400px;<br />
border:5px solid #000;<br />
z-index: 9002;<br />
}</p>
</div>
<p>There is a Javacript file linked to the html file to make some of the magic happen. I&#8217;m going to make the demo files available so you can play with it and make your own. <strong>Enjoy!</strong></p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/css-popup/css-popup.zip">Download Files</a></p>
<p>One last thing.. the original code for this was <a href="http://www.pat-burt.com/web-development/how-to-do-a-css-popup-without-opening-a-new-window/">found here</a>. I made some edits to make it work for my application.</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/12/how-to-create-a-popup-with-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Embed a Twitter Feed on your website with jQuery</title>
		<link>http://webdesignandsuch.com/2009/12/embed-a-twitter-feed-on-your-website-with-jquery/</link>
		<comments>http://webdesignandsuch.com/2009/12/embed-a-twitter-feed-on-your-website-with-jquery/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 01:17:34 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Twit]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=612</guid>
		<description><![CDATA[
			
				
			
		

In a previous post I showed possibly the easiest way to embed a Twitter feed on your website. This brought up a couple of questions from some users.
1. Can you make a background behind individual Tweets?
2. Can you put the date on it&#8217;s own separate line?
As the case goes with a lot of things these [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F12%2Fembed-a-twitter-feed-on-your-website-with-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F12%2Fembed-a-twitter-feed-on-your-website-with-jquery%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img alt="" src="http://webdesignandsuch.com/posts/jQuery-twitter/twitter.jpg" title="embed twitter" class="alignnone" width="422" height="211" style="border:3px solid #ddd; margin:0 0 15px 0"/></p>
<p>In a <a href="http://webdesignandsuch.com/2009/11/how-to-embed-a-twitter-feed-on-your-website/">previous post</a> I showed possibly the easiest way to embed a Twitter feed on your website. This brought up a couple of questions from some users.</p>
<p><strong>1. Can you make a background behind individual Tweets?<br />
2. Can you put the date on it&#8217;s own separate line?</strong></p>
<p>As the case goes with a lot of things these days <em><strong>jQuery to the rescue</strong></em>! Check out the demo to see both of these things in action, and then continue reading to see how to accomplish these things with jQuery and download the source files.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/jQuery-twitter/">View Demo</a><span id="more-612"></span></p>
<p>The jQuery and CSS code to make this happen came from Chris over at CSS-Tricks. I slimmed down and edited it to make it work for me. Here is a zip of the files used for the demo so you can download and edit it as you want.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/jQuery-twitter/jQuery-twitter.zip">Download Files</a></p>
<p>You&#8217;ll see in the head of the index page the jQuery which makes it work. The line you need to change is the following:</p>
<div class="codeBox">
<strong>http://twitter.com/status/user_timeline/<span style="color:#09a1dc">ilz_</span>.json?<span style="color:#09a1dc">count=5</span>&#038;callback=?</strong></div>
<p>First replace the part I highlighted in Blue &#8220;ilz_&#8221; with your Twitter user name.<br/><br />
Next, replace &#8220;count=5&#8243; with the number of tweets you want to show up on your page.</p>
<p>Other than that, you should be able to style the rest of the text, links, etc. as long as you know basic CSS. <strong>Enjoy!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/12/embed-a-twitter-feed-on-your-website-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Box-Shadow with CSS3</title>
		<link>http://webdesignandsuch.com/2009/11/using-box-shadow-with-css3/</link>
		<comments>http://webdesignandsuch.com/2009/11/using-box-shadow-with-css3/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 00:20:54 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Box-Shadow]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=567</guid>
		<description><![CDATA[
			
				
			
		

I showed in a previous post how to use text-shadow with CSS3. Now it&#8217;s time to move on to something that&#8217;s just about as exciting, using Box-Shadow with CSS3. Throw it on a div, on a table, on an image.. anything goes! Of course it doesn&#8217;t work in every browser, but then again not much [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F11%2Fusing-box-shadow-with-css3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F11%2Fusing-box-shadow-with-css3%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img class="alignnone" style="border:3px solid #ddd; margin:0 0 15px 0; -webkit-box-shadow: 0px 0px 7px #2178c7; -moz-box-shadow: 0px 0px 7px #2178c7" title="box shadow" src="http://webdesignandsuch.com/imagesForPosts/box-shadow.jpg" alt="" width="422" height="211" /></p>
<p>I showed in a <a href="http://webdesignandsuch.com/2009/11/using-text-shadow-with-css3/">previous post</a> how to use text-shadow with CSS3. Now it&#8217;s time to move on to something that&#8217;s just about as exciting, using <strong>Box-Shadow with CSS3</strong>. Throw it on a div, on a table, on an image.. anything goes! Of course it doesn&#8217;t work in every browser, but then again not much I talk about on this site does!</p>
<p>Check out the demo to see some examples and then keep reading to find out how to use <strong>Box-Shadow</strong>.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/box-shadow/box-shadow.html">View Demo</a><br />
<span id="more-567"></span><br />
Below are the examples from the demo page, with the code below it which made the shadow. For each shadow, you need to declare the dimensions for <strong>-webkit-box-shadow:</strong> and <strong> -moz-box-shadow:</strong>, which takes care of any browser that supports the box-shadow at this point.</p>
<p>The three numbers are similar to using text-shadow with CSS3, the first number is <strong>how far right</strong> the shadow is from the &#8220;box&#8221;, the next number is <strong>how far below</strong>, and the final number is the <strong>amount of blur</strong> for the shadow. Finally, you <strong>declare the color</strong> of the shadow.</p>
<p>You&#8217;ll see on a couple of them I used the awesome border-radius to show how the shadow wraps around a rounded corner. If you need a refresher on the border-radius declarations, <a href="http://webdesignandsuch.com/2009/10/rounded-corners-with-css3-border-radius/">look here</a>. If you want to check out some examples and code of text-shadow, <a href="http://webdesignandsuch.com/2009/11/using-text-shadow-with-css3/">look here</a>.</p>
<div class="codeBox" ><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 2px 2px 4px #000; -moz-box-shadow: 2px 2px 4px #000"/></p>
<p>{<br />-webkit-box-shadow: 2px 2px 4px #000; <br />-moz-box-shadow: 2px 2px 4px #000<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 6px 6px 6px #444; -moz-box-shadow: 6px 6px 6px #444"/></p>
<p>{<br />-webkit-box-shadow: 6px 6px 6px #444;<br />-moz-box-shadow: 6px 6px 6px #444<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 4px 4px 6px #fc6; -moz-box-shadow: 4px 4px 6px #FF66CC"/></p>
<p>{<br />-webkit-box-shadow: 4px 4px 6px #F6C;<br />-moz-box-shadow:4px 4px 6px #F6C<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 6px 6px 10px #000; -moz-box-shadow: 6px 6px 10px #000; -webkit-border-radius:12px; -moz-border-radius:12px; border:15px solid #FF9900"/></p>
<p>{<br />-webkit-box-shadow: 6px 6px 10px #000; <br />-moz-box-shadow: 6px 6px 10px #000;<br />-webkit-border-radius:12px;<br />
-moz-border-radius:12px; <br />border:15px solid #F90<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 6px 6px 10px #990; -moz-box-shadow: 6px 6px 10px #990; -webkit-border-radius:12px; -moz-border-radius:12px; border:12px solid #000"/></p>
<p>{<br />-webkit-box-shadow: 6px 6px 10px #990; <br />-webkit-border-radius:12px; <br />-moz-box-shadow: 6px 6px 10px #990;<br />-moz-border-radius:12px; <br />border:12px solid #000<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 0px 0px 20px #6F0; -moz-box-shadow: 0px 0px 20px #66FF00"/></p>
<p>{<br />-webkit-box-shadow: 0px 0px 20px #6F0;<br />-moz-box-shadow: 0px 0px 20px #6F0<br />}</div>
<div class="codeBox" style="margin-top:20px"><img class="alignnone" title="nice" src="http://webdesignandsuch.com/posts/box-shadow/rico.jpg" alt="" width="400" height="300" style="-webkit-box-shadow: 0px 0px 30px #000; -moz-box-shadow: 0px 0px 30px #000"/></p>
<p>{<br />-webkit-box-shadow: 0px 0px 30px #000; <br />-moz-box-shadow: 0px 0px 30px #000<br />}</div>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/11/using-box-shadow-with-css3/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using Text-Shadow with CSS3</title>
		<link>http://webdesignandsuch.com/2009/11/using-text-shadow-with-css3/</link>
		<comments>http://webdesignandsuch.com/2009/11/using-text-shadow-with-css3/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 19:03:07 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Text-Shadow]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=538</guid>
		<description><![CDATA[
			
				
			
		

Remember the old days when the only way to create a shadow on text was to make it an image? That&#8217;s good for search engines..right? Oh sure, just use some image replacement and then the search engines can read it. Not so easy for text edits in the future. Or for changing the color of [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F11%2Fusing-text-shadow-with-css3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F11%2Fusing-text-shadow-with-css3%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img alt="" src="http://webdesignandsuch.com/imagesForPosts/text-shadow.jpg" title="CSS3 text shadow" class="alignnone" width="422" height="211" style="border:3px solid #bbb; margin:0 0 15px 0"/></p>
<p>Remember the old days when the only way to create a shadow on text was to make it an image? <em>That&#8217;s good for search engines..right?</em> Oh sure, just use some image replacement and then the search engines can read it. Not so easy for text edits in the future. Or for changing the color of the text or the background behind the text.</p>
<p><strong>Fastforward to CSS3</strong>. Now we can define a shadow behind live text on a website. <em>Wiggity whaaat?</em> That&#8217;s right, simply with some good old CSS. Of course you&#8217;ll need to use a real browser, as of any other cool CSS technique, but I won&#8217;t even begin to go into that topic. <strong>So why is this so great?</strong></p>
<ul>
<li><strong>Search engines can read the text</strong></li>
<li><strong>Easily change the color of the text</strong></li>
<li><strong>Easily change the color, size, or blur of the shadow</strong></li>
<li><strong>Easily change the background color or image behind the text</strong></li>
<li><strong>Your friends will be like<em> totally impressed</em></strong></li>
</ul>
<p>An example of this is the title to every article on this lil website of mine. Do you see the shadow behind the title &#8220;<strong>Using Text-Shadow with CSS3</strong>&#8220;? If you don&#8217;t for the love of god.. <a href="http://www.mozilla.com/en-US/firefox/personal.html">DOWNLOAD FIREFOX</a>! Check out the demo for some more examples of text-shadow created with CSS3, and then continue reading to learn how to write the CSS.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/text-shadow/text-shadow.html">View Demo</a></p>
<p><span id="more-538"></span></p>
<p>The CSS to create the text-shadow is pretty simple. It&#8217;s written like this:</p>
<p> <strong>{text-shadow: 2px 2px 4px #000}</strong> </p>
<p>The first number is how far right of the text the shadow should go, the second is how far below the text, and the final number is the amount of blur to apply to the shadow. Then of course the color of the shadow is declared.</p>
<p>You can see below the examples from the demo page, and below them are the CSS styles that create each effect.</p>
<div class="codeBox">
<h1 style="color:#000; text-shadow:2px 2px 4px #000">H1 with text-shadow applied.</h1>
<p>{color:#000; text-shadow:2px 2px 4px #000}</p></div>
<p></p>
<div class="codeBox">
<h1 style="color:#000; text-shadow:2px 2px 8px #000">More blur applied to the shadow.</h1>
<p>{color:#000; text-shadow:2px 2px 8px #000}</p></div>
<p></p>
<div class="codeBox">
<h1 style="color:#000; text-shadow:4px 4px 4px #CCC; line-height:25px">Same blur, more distance, lighter color.</h1>
<p>{color:#000; text-shadow:4px 4px 4px #CCC}</p></div>
<p></p>
<div class="codeBox">
<h1 style="color:#006; text-shadow:2px 2px 4px #00C">Using color for the shadow.</h1>
<p>{color:#006; text-shadow:2px 2px 4px #00C}</p></div>
<p></p>
<div class="codeBox">
<h1 style="color:#F09; text-shadow:2px 2px 5px #F6F">Another example of color.</h1>
<p>{color:#F09; text-shadow:2px 2px 5px #F6F}</p></div>
<p></p>
<p>In this next example you can see how you can create a beveled look by using a shadow that goes zero pixels to either side, but goes 1 pixel straight up above the text.</p>
<div class="codeBox">
<h1 style="color:#090; text-shadow:0px -1px 0px #000">Create a beveled look.</h1>
<p>{color:#090; text-shadow:0px -1px 0px #000}</p>
</div>
<p><strong>So there it is, creating text-shadows with CSS3.</strong> You might also want to check out a <a href="http://webdesignandsuch.com/2009/10/rounded-corners-with-css3-border-radius/">recent article</a> where I show how to use border-radius with CSS3; (which is how the rounded corners on these divs above were created).</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/11/using-text-shadow-with-css3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a Shiny &#8220;Web 2.0&#8243; Button</title>
		<link>http://webdesignandsuch.com/2009/10/create-a-shiny-web-2-0-button/</link>
		<comments>http://webdesignandsuch.com/2009/10/create-a-shiny-web-2-0-button/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 01:20:39 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=503</guid>
		<description><![CDATA[
			
				
			
		

Ya.. I said &#8220;Web 2.0&#8220;.. what?
Well if you&#8217;re still here after that, here&#8217;s the deal. I was reading an interesting tutorial about creating a button similar to the one found on the Campaign Monitor website. I actually went ahead and created the button, I always love seeing the approach other designers take at creating things [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fcreate-a-shiny-web-2-0-button%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fcreate-a-shiny-web-2-0-button%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img class="alignnone" style="border:3px solid #ddd; margin:0 0 15px 0" title="Shiny Button" src="http://webdesignandsuch.com/imagesForPosts/shiny-button.jpg" alt="" width="422" height="211" /></p>
<p>Ya.. I said &#8220;<strong>Web 2.0</strong>&#8220;.. what?</p>
<p>Well if you&#8217;re still here after that, here&#8217;s the deal. I was reading an interesting tutorial about creating a button similar to the one found on the <a href="http://www.campaignmonitor.com/designer/" target="_blank">Campaign Monitor website</a>. I actually went ahead and created the button, I always love seeing the approach other designers take at creating things in Photoshop.</p>
<p>Well after I created it I figured I may as well put the PSD file up here for anyone that wants to use it. I&#8217;ll give the CSS code to add it to your website as a CSS sprite also. Now I need to give credit where credit is due. The CSS code, and the tutorial of how to make the button are from Jacob Gube over at <a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-create-a-slick-and-clean-button-in-photoshop/" target="_blank">Six Revisions</a>. Check out that link if you want the step by step of how to make this button. </p>
<p>I&#8217;m really putting it up here so I&#8217;ll have easy access to the PSD file in the future so I can download it no-matter where I am, make a few color adjustments, copy the CSS code, and have a new button for whatever I&#8217;m working on that day. Check out the demo to see the button in action, and feel free to download the PSD file of my version of the button. <em>Keep reading for the CSS code.</em></p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/shiny-button/">View Demo</a></p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/shiny-button/shiny-button.psd">Download PSD File</a></p>
<p><span id="more-503"></span></p>
<p>Below is the CSS code for your button and the rollover effect.</p>
<div class="codeBox">.button {<br />
display:block;<br />
width:250px;<br />
height:50px;<br />
text-indent:-9999px;<br />
}<br />
.button a {<br />
display:block;<br />
width:100%;<br />
height:100%;<br />
background:url(button.png) no-repeat top left;<br />
outline:none;<br />
}<br />
.button a:hover {<br />
background-position:0 -50px;<br />
}<br />
body {<br />
margin-left: 0px;<br />
margin-top: 0px;<br />
margin-right: 0px;<br />
margin-bottom: 0px;<br />
}</div>
<p>Below is the XHTML code to put the button on your page.</p>
<div class="codeBox">&lt;p class=&#8221;button&#8221;&gt;&lt;a href=&#8221;link.html&#8221;&gt;Button Text&lt;/a&gt;&lt;/p&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/10/create-a-shiny-web-2-0-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change the default Background Color of Text on Selection with CSS</title>
		<link>http://webdesignandsuch.com/2009/10/change-the-default-background-color-of-text-on-selection-with-css/</link>
		<comments>http://webdesignandsuch.com/2009/10/change-the-default-background-color-of-text-on-selection-with-css/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 23:22:07 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Text Selection]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=481</guid>
		<description><![CDATA[
			
				
			
		

Here&#8217;s another interesting thing you can do with your CSS to style your website. We&#8217;ve all selected text from a webpage with our cursor before right? But most likely you never put any thought into what the default background color of the text was when you were selecting it. That is unless the website has [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fchange-the-default-background-color-of-text-on-selection-with-css%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fchange-the-default-background-color-of-text-on-selection-with-css%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img alt="" src="http://webdesignandsuch.com/posts/text-selection/colors.gif" title="CSS" class="alignnone" width="422" height="211"  style="border:3px solid #ddd; margin:0 0 15px 0"/><br />
<strong>Here&#8217;s another interesting thing you can do with your CSS to style your website.</strong> We&#8217;ve all selected text from a webpage with our cursor before right? But most likely you never put any thought into what the default background color of the text was when you were selecting it. That is unless the website has a blue background and you can&#8217;t see what you&#8217;re selecting because the default background color of text on selection is blue, causing it to blend in. </p>
<p>Lets get right to the example I set up so you can see what I&#8217;m talking about. Not only can you control the background color of the text when you select it with your cursor, but you can also change the color of the text itself on select.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/text-selection/">View Demo</a><br />
<span id="more-481"></span></p>
<p>So I&#8217;m not even going to get into the whole <em>&#8220;This only works in this browser, this version, blah blah&#8221;</em>. I assume anyone using this website knows the ins and outs of browsers and uses a <strong><a href="http://www.mozilla.com/en-US/firefox/personal.html">real browser</a></strong>. That being said, here is the code I used to change the colors on the demo page.</p>
<div class="codeBox">#second p::selection {<br />
background:#F3F;<br />
}<br />
#second p::-moz-selection {<br />
background:#F3F;<br />
}</p>
<p>#third p::selection {<br />
background:#F93; color:#339;<br />
}<br />
#third p::-moz-selection {<br />
background:#F93; color:#339;<br />
}</p>
<p>#forth p::selection {<br />
background:#000; color:#FFF<br />
}<br />
#forth p::-moz-selection {<br />
background: #000; color:#FFF<br />
}</p></div>
<p>So that&#8217;s all there is to it. One of those things that might not make or break a website, but is a nice touch to make your site even more custom, or perhaps even more user friendly.</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/10/change-the-default-background-color-of-text-on-selection-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Navigation with an Unordered List &amp; CSS3</title>
		<link>http://webdesignandsuch.com/2009/10/create-a-navigation-with-an-unordered-list-css3/</link>
		<comments>http://webdesignandsuch.com/2009/10/create-a-navigation-with-an-unordered-list-css3/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 11:42:04 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=465</guid>
		<description><![CDATA[
			
				
			
		

Using an unordered list is a simple and easy to style method of creating a navigation bar. Now with CSS3 and round corners created by the browser, it&#8217;s even easier to make a nice and clean nav. I introduced CSS3&#8217;s border-radius in a previous post, located here.
Check out the example I created, and then keep [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fcreate-a-navigation-with-an-unordered-list-css3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F10%2Fcreate-a-navigation-with-an-unordered-list-css3%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><a href="http://webdesignandsuch.com/posts/nav/ul-nav.html"><img class="alignnone" title="nav" src="http://webdesignandsuch.com/posts/nav/nav.jpg" alt="" width="422" height="140" class="frame"/></a></p>
<p>Using an unordered list is a simple and easy to style method of creating a navigation bar. Now with CSS3 and round corners created by the browser, it&#8217;s even easier to make a nice and clean nav. I introduced CSS3&#8217;s border-radius in a previous post, <a href="http://webdesignandsuch.com/2009/10/rounded-corners-with-css3-border-radius/">located here</a>.</p>
<p>Check out the example I created, and then keep reading to find out how to create the above nav with nothing more than some CSS.</p>
<p><a class="demo-link" href="http://webdesignandsuch.com/posts/nav/ul-nav.html">View Demo</a><br />
<span id="more-465"></span><br />
<strong>First create your unordered list in your XHTML.</strong></p>
<div class="codeBox">&lt;ul&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221; class=&#8221;current&#8221;&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;About&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Services&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</div>
<p>The first thing to do with your CSS is to make your unordered list display on the same line, and with no bullet points.</p>
<div class="codeBox">ul {list-style-type:none}<br />
li {display:inline}</div>
<p><strong>The next step is to style the links.</strong> We&#8217;ll add some padding around the links to space them out, and to give the background color the width and height we want. On the hover state of the links I made the border appear as you roll over the link. </p>
<p>You&#8217;ll see I made an &#8220;active&#8221; state for the current page you are on. I set the cursor for the active state to be the &#8220;default&#8221; cursor. This is so when you roll over the link of the current page you are on the pointer cursor will turn into the arrow, giving the illusion that it isn&#8217;t a link (even though it really is).</p>
<div class="codeBox">a:link, a:visited {text-decoration:none; color:#ccc; border:#000 1px solid; padding:5px 15px; -webkit-border-radius:10px; -moz-border-radius:10px}</p>
<p>a:hover, a:active {text-decoration:none; color:#ccc; border:#333 1px solid; padding:5px 15px; -webkit-border-radius:10px; -moz-border-radius:10px }</p>
<p>a.current {-webkit-border-radius:10px; -moz-border-radius:10px; background:#333; color:#FFF; border:#333 1px solid; cursor:default}</p></div>
<p>So there it is, with this basic foundation and your imagination you can make a variety of looks for your navigation. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/10/create-a-navigation-with-an-unordered-list-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review of Web Standards Solutions by Dan Cederholm</title>
		<link>http://webdesignandsuch.com/2009/09/review-of-web-standards-solutions-by-dan-cederholm/</link>
		<comments>http://webdesignandsuch.com/2009/09/review-of-web-standards-solutions-by-dan-cederholm/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 14:01:10 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[Book Review]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Semantic]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Web Standards Solutions]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=370</guid>
		<description><![CDATA[
			
				
			
		
Recently released was a book by Dan Cederholm called Web Standards Solutions, The Markup and Style Handbook. This is the follow-up to an earlier version of the book. This brings up two questions. 
1. Do you need this book if you have neither version?
2. If you do have the first version is it worth purchasing [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F09%2Freview-of-web-standards-solutions-by-dan-cederholm%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F09%2Freview-of-web-standards-solutions-by-dan-cederholm%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p>Recently released was a book by Dan Cederholm called <strong><em>Web Standards Solutions, The Markup and Style Handbook</em></strong>. This is the follow-up to an earlier version of the book. This brings up two questions. </p>
<p><strong>1.</strong> Do you need this book if you have neither version?<br />
<strong>2.</strong> If you do have the first version is it worth purchasing the new version? </p>
<p><strong><em>Keep reading to find out.</em></strong><br />
<img class="alignnone" title="Web standards solutions" src="http://ecx.images-amazon.com/images/I/41zmofVDuAL.jpg" alt="" width="417" height="500"  class="frame"/><br />
<span id="more-370"></span></p>
<p>I purchased the second version of the book because the first version was a great book full of some useful techniques for any webdesigner that cares about good CSS and XHTML. After flipping through the new book, it looked an awful lot like the original, so I dug in deeper.</p>
<p>The book covers some things that are important to writing semantic XHTML. Such as using unordered lists to create a navigation.</p>
<div class="codeBox">&lt;ul&gt;<br />
&lt;li&gt;Home Page&lt;/li&gt;<br />
&lt;li&gt;About&lt;/li&gt;<br />
&lt;li&gt;Services&lt;/li&gt;<br />
&lt;/ul&gt;</div>
<p>I use unordered lists for all my navigations, as a lot of webdesigners do. You can take off the bullets, make it inline, add background images, rollovers, etc. Good stuff. Pretty basic IMO, but if you don&#8217;t know these techniques, this book covers it in depth.</p>
<p>Styling tables is covered. Yes, tables are horrible, but for tabular data they are still acceptable to use. And if styled nicely, they can be visually appealing. You can have the <strong>&lt;tr&gt;</strong> turn a different shade or color on rollover, which makes it easier to keep track of where you are reading on the page.</p>
<p>One of my favorite techniques Dan goes over is styling a <strong>blockquote</strong>. He has a technique that gives a rounded box with a large quote image in the background; one for the opening quote, and one for the closing quote. The tricky part here is making it expand, so no matter how long your quote is the box will stretch and the closing quote will be on the bottom right. Worth a bookmark for sure.</p>
<p>Next up is styling forms. I actually learned a lot of what I know about styling forms from the first version of this book. Styling the <strong>&lt;fieldset&gt;</strong> gives a nice clean look to the form. Best yet, you get to write hacks for IE!<br />
<img class="alignnone" title="WSS" src=" http://webdesignandsuch.com/imagesForPosts/wss-3.jpg" alt="" width="946" height="768"  class="frame"/><br />
Next up in the book is one of the topics new to this version 2 of the book. <strong><a href="http://microformats.org/">Microfomats!</a></strong> Now you may not know what these are, a lot of people probably don&#8217;t. I read about these a while back, and still haven&#8217;t used them. It makes sense though, and will hopefully catch on and be used in the future, so it&#8217;s great that Dan covered it here. Here is an example of what Microformats are. Say you have a website with a contact page. You can add what&#8217;s called a <strong>hCard</strong> to the page. This hCard contains all your contact information, allowing users to click on it and add it to their computers address book. Other software and web applications can scrape your website and extract this information from the hCard. The same goes for events, dates, etc. Microformats only make sense, so I&#8217;m sure in the future they will be huge.</p>
<p>Next up is styling <strong>&lt;dl&gt;</strong> and <strong>&lt;dt&gt;</strong> lists. This is something I personally need to use more often, I always use the unordered lists, when sometimes these other two options would be the better choice. Bookmarked!</p>
<p><img class="alignnone" title="Web Standards Solutions" src=" http://webdesignandsuch.com/imagesForPosts/wss-1.jpg" alt="" width="941" height="653" class="frame"/></p>
<p>There is a nice technique for a CSS style switcher. I actually just showed a way of adding a style switcher that works by itself, depending on the hour of the day. <a href="http://webdesignandsuch.com/2009/09/css-stylesheet-switcher-javascript-dreamweaver-kaos/">That post is right here.</a> This is a manual technique. I&#8217;ve used this technique in the past, and will cover it in a post in the near future.</p>
<p>Other topics include image replacement, using reset styles for your CSS, and CSS Sprites. Using print styles is covered, another topic I need to come back to as I don&#8217;t take advantage of these enough.</p>
<p>So to wrap up my review of this book I must answer the questions I asked. Do you need this book if you don&#8217;t have either? <strong>Yes</strong>, <a href="http://www.amazon.com/gp/product/1430219203/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=486539851&#038;pf_rd_s=lpo-top-stripe-1&#038;pf_rd_t=201&#038;pf_rd_i=1590593812&#038;pf_rd_m=ATVPDKIKX0DER&#038;pf_rd_r=12JZGQ0PAAGAPBDJAP59">go and buy it immediately</a>. I don&#8217;t care if you&#8217;re an expert or a beginner. If you&#8217;re a beginner you need to learn the basics covered in this book, and then move on to the more advanced topics also covered. If you&#8217;re an expert than you already know who Dan Cederholm is, and that&#8217;s reason enough to buy the book.<br />
<img class="alignnone" title="WSS" src=" http://webdesignandsuch.com/imagesForPosts/wss-2.jpg" alt="" width="941" height="653"  class="frame"/><br />
What if you already have the first book.. is there enough new content in this book to rationalize buying the new version? <strong>Nope.</strong> You&#8217;re going to find yourself flipping through the pages looking for the new content. If you&#8217;re like me, you have a stack of books you&#8217;re trying to get through so having duplicate content is useless. The good news is you can give Dan your money in another way! May I recommend his new book, <a href="http://www.amazon.com/Handcrafted-CSS-More-Bulletproof-Design/dp/0321643380/ref=pd_sim_b_3"><strong><em>Handcrafted CSS</em></strong></a>. A great read, which I will review soon.</p>
<p>So there you have it, I hope I helped some people with their decision making.</p>
<p>-ilz</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/09/review-of-web-standards-solutions-by-dan-cederholm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to load a random image on pageload ~ Javascript</title>
		<link>http://webdesignandsuch.com/2009/09/how-to-load-a-random-image-on-pageload-javascript/</link>
		<comments>http://webdesignandsuch.com/2009/09/how-to-load-a-random-image-on-pageload-javascript/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:27:10 +0000</pubDate>
		<dc:creator>ilz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[load random image]]></category>

		<guid isPermaLink="false">http://webdesignandsuch.com/?p=386</guid>
		<description><![CDATA[
			
				
			
		

On my portfolio website I have an About page, where I explain&#8230; who I am of course! So I have a picture of myself in the sidebar, but got the idea that it&#8217;d be nice to have the picture change randomly on page load. I looked around at a few different options. Some were Javascript, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F09%2Fhow-to-load-a-random-image-on-pageload-javascript%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fwebdesignandsuch.com%2F2009%2F09%2Fhow-to-load-a-random-image-on-pageload-javascript%2F&amp;style=normal" height="61" width="51" /><br />
			</a>
		</div>
<p><img alt="" src="http://webdesignandsuch.com/imagesForPosts/me.jpg" title="Beantown Design" class="alignnone" width="560" height="332" /></p>
<p>On my portfolio website I have an <strong><a href="http://beantowndesign.com/about.html">About page</a></strong>, where I explain&#8230; who I am of course! So I have a picture of myself in the sidebar, but got the idea that it&#8217;d be nice to have the picture change randomly on page load. I looked around at a few different options. Some were Javascript, some were PHP. It wasn&#8217;t worth turning the page into a PHP page just for this effect, so I went with Javascript. There are a lot of different options, but here&#8217;s the one I went with. </p>
<p><span id="more-386"></span></p>
<p>I made a div to surround the image, with the class of &#8220;me-box&#8221;. I gave this div a border, so the images will all appear to have a border when they are loaded. Next comes the Javascript code. This is where you give the src to your images. This code is put right in the body of your page where you want the images to appear, not in he head tag. A quick little piece of code that got the job done exactly like I wanted!</p>
<p><a href="http://beantowndesign.com/about.html">See the random image loading in action.</a></p>
<div class="codeBox">
<p>&lt;div class=&#8221;me-box&#8221;&gt;</p>
<p>&lt;script language=&#8221;JavaScript&#8221;&gt;<br />
function banner() { } ; b = new banner() ; n = 0<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me.jpg&#8217; &gt;&#8221;<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me2.jpg&#8217; &gt;&#8221;<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me4.jpg&#8217; &gt;&#8221;<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me5.jpg&#8217; &gt;&#8221;<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me6.jpg&#8217; &gt;&#8221;<br />
b[n++]= &#8220;&lt;img name=randimg src=&#8217;images/me3.jpg&#8217; &gt;&#8221;<br />
i=Math.floor(Math.random() * n) ;<br />
document.write( b[i] )<br />
&lt;/script&gt;</p>
<p>&lt;/div&gt;</p></div>
]]></content:encoded>
			<wfw:commentRss>http://webdesignandsuch.com/2009/09/how-to-load-a-random-image-on-pageload-javascript/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
