<?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>Dev Tips &#124; Become a Better Developer, One Tip at a Time. &#187; HTML/CSS</title>
	<atom:link href="http://dev-tips.com/category/client-side/htmlcss/feed" rel="self" type="application/rss+xml" />
	<link>http://dev-tips.com</link>
	<description>Become a Better Developer, One Tip at a Time.</description>
	<lastBuildDate>Sun, 07 Mar 2010 02:19:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Introducing Minerva &#8211; A Creative Portfolio Theme</title>
		<link>http://dev-tips.com/featured/introducing-minerva-a-creative-portfolio-theme</link>
		<comments>http://dev-tips.com/featured/introducing-minerva-a-creative-portfolio-theme#comments</comments>
		<pubDate>Wed, 06 Jan 2010 04:52:43 +0000</pubDate>
		<dc:creator>Drew Douglass</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Site News]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=762</guid>
		<description><![CDATA[Recently, I teamed up with very talented designer and personal friend Baz Deas to form a small and fun ThemeForest team. We came up with a name, DesignThirst, and have released our first premium HTML template on ThemeForest. Minerva, the name of the theme, is a premium and very fresh corporate/portfolio theme. Just check out [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I teamed up with very talented designer and personal friend <a href='http://bazdeas.com' title='Baz Deas Portfolio'>Baz Deas</a> to form a small and fun ThemeForest team. We came up with a name, <a href='http://designthirst.net'>DesignThirst</a>, and have released our first premium HTML template on <a href='http://themeforest.net/?ref=designthirst' title='ThemeForest'>ThemeForest</a>. Minerva, the name of the theme, is a <a href='http://themeforest.net/item/minerva-xhtml-theme/75547?ref=designthirst' title='Minerva Premium HTML Theme'>premium and very fresh corporate/portfolio theme</a>. Just check out some the features!</p>
<p><span id="more-762"></span></p>
<h2>Introducing "Minerva"</h2>
<p>
<blockquote>Minerva is a fresh and clean site template that works great as a portfolio, personal, blog, or corporate site. Minerva comes packed with features and is ready to go out of the box. It even comes with a working AJAX &#038; PHP contact form w/ spam protection!</p></blockquote>
<h2>Screenshots</h2>
<p><a href="http://dev-tips.com/wp-content/uploads/2010/01/preview_minerva.jpg"><img src="http://dev-tips.com/wp-content/uploads/2010/01/preview_minerva.jpg" alt="" title="preview_minerva" width="590" height="300" class="aligncenter size-full wp-image-763" /></a></p>
<h3>Home Page</h3>
<p><a href="http://dev-tips.com/wp-content/uploads/2010/01/home_minerva.png"><img src="http://dev-tips.com/wp-content/uploads/2010/01/home_minerva.png" alt="" title="home_minerva" width="600" height="279" class="aligncenter size-full wp-image-764" /></a></p>
<h3>Footer</h3>
<p><a href="http://dev-tips.com/wp-content/uploads/2010/01/footer_minerva.png"><img src="http://dev-tips.com/wp-content/uploads/2010/01/footer_minerva.png" alt="" title="footer_minerva" width="600" height="279" class="aligncenter size-full wp-image-767" /></a></p>
<h3>Contact Page</h3>
<p><a href="http://dev-tips.com/wp-content/uploads/2010/01/contact_minerva.png"><img src="http://dev-tips.com/wp-content/uploads/2010/01/contact_minerva.png" alt="" title="contact_minerva" width="600" height="279" class="aligncenter size-full wp-image-768" /></a></p>
<h3>Blog Comments</h3>
<p><a href="http://dev-tips.com/wp-content/uploads/2010/01/blog_comments_minerva.png"><img src="http://dev-tips.com/wp-content/uploads/2010/01/blog_comments_minerva.png" alt="" title="blog_comments_minerva" width="600" height="279" class="aligncenter size-full wp-image-769" /></a></p>
<h2>Theme Features</h2>
<ul>
<li>Working  AJAX  &#38;  PHP  Contact form.</li>
<li>Nice jQuery effects in the Footer and &#8216;Share This&#8217; section.</li>
<li>Easy to use jQuery Slider in the header.</li>
<li>Custom Font Embedding with Cufon, falls back on awesome font stacks and still looks great.</li>
<li>5 Different page types included.</li>
<li>Supported in all major browsers, including  IE6!</li>
<li>Valid  XHTML </li>
<li>Custom and in depth online and offline documentation and support.</li>
<li>Clean, elegant, and semantic code aids in good  SEO .</li>
<li>Minimal use of images and creative use of sprites to save loading times.</li>
<li>Special attention paid to elements and typography, see demo page.</li>
</ul>
<h2>Demo, Documentation, &#38; Support</h2>
<h3><a href="http://designthirst.net/themes/minerva/"> </a><a href="http://designthirst.net/themes/minerva/">http://designthirst.net/themes/minerva/</a>  &#8211; Live Demo </h3>
<h3><a href="http://designthirst.net/docs/minerva/"> </a><a href="http://designthirst.net/docs/minerva/">http://designthirst.net/docs/minerva/</a>   &#8211; Online Documentation</h3>
<h3><a href="http://twitter.com/DesignThirst"> </a><a href="http://twitter.com/DesignThirst">http://twitter.com/DesignThirst</a>  &#8211; DesignThirst on Twitter</h3>
<h2>Get Minerva now!</h2>
<p>You can <a href='http://themeforest.net/item/minerva-xhtml-theme/75547?ref=designthirst' title='Minerva Premium HTML Theme'>get Minerva right now</a>, available exclusively through <a href='http://themeforest.net/item/minerva-xhtml-theme/75547?ref=designthirst' title='Minerva Premium HTML Theme'>ThemeForest</a>.<br />
<a href="http://themeforest.net/item/minerva-xhtml-theme/75547?ref=designthirst"><img src="http://dev-tips.com/wp-content/uploads/2010/01/get_minerva_button.jpg" alt="" title="get_minerva_button" width="277" height="81" /></a></p>
<h2>Feedback, Updates, and Feature Requests</h2>
<p>If you didn't know, once you buy a theme on ThemeForest, <strong>you can download any updates made to that item for free at anytime!</strong> That said, <strike>we're about to release Minerva version 1.1</strike> version 1.1 has been released!, which comes with some small enhancements, so no matter when you buy it, you'll forever have access to upgrades for free!</p>
<p>I'd love to hear any feedback or feature requests, let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/introducing-minerva-a-creative-portfolio-theme/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>5 Advanced CSS Techniques To Increase Your Skill Set</title>
		<link>http://dev-tips.com/featured/5-advanced-css-techniques-to-increase-your-skill-set</link>
		<comments>http://dev-tips.com/featured/5-advanced-css-techniques-to-increase-your-skill-set#comments</comments>
		<pubDate>Fri, 04 Dec 2009 01:15:07 +0000</pubDate>
		<dc:creator>Muhammad Adnan</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=645</guid>
		<description><![CDATA[The number of CSS techniques that can be used to achieve a certain effect is plentiful. As CSS standards progress, so do our options when it comes to working with CSS. Today, we will have a look at 5 advanced CSS techniques that will help to increase your skill set. Tutorial Details Program/Language: CSS Language [...]]]></description>
			<content:encoded><![CDATA[<p>The number of CSS techniques that can be used to achieve a certain effect is plentiful. As CSS standards progress, so do our options when it comes to working with CSS. Today, we will have a look at 5 advanced CSS techniques that will help to increase your skill set.</p>
<p><span id="more-645"></span></p>
<h3>Tutorial Details</h3>
<ul>
<li><b>Program/Language</b>: CSS</li>
<li><b>Language Version</b>: 2.1</li>
<li><b>Difficulty:</b> Beginner/Intermediate</li>
<li><b>Estimated Completion Time:</b> 30 minutes</li>
</ul>
<p>Below you will find a list of the different advanced CSS techniques we will shortly discuss in this article.</p>
<ol>
<li>Scaling the background image to browsers' window size (e.g.Twitter).</li>
<li>Text &#038; image indentation.</li>
<li>Z-index in object elements.</li>
<li>CSS shadows.</li>
<li>CSS user interface enhancements</li>
</ol>
<h3>Scaling the image background to browsers' window size (e.g.Twitter)</h3>
<p>If you take a look at the way Twitter handles user backgrounds, you will notice that there is a sort of scaling effect going on. This helps ensure that the page displays in an aesthetically pleasing way. A few months ago, I had to scale an image to the size of the browser. I tried many solutions, both with and without JavaScript, but they never fit the screen properly. I desired for the background to stay fixed and stretch across the windows size just like Twitter. Finally, I came up with a solution, and I'm going to share that solution with you today.</p>
<p>Let’s begin with the XHTML markup below:</p>
<pre class="brush: html">
		&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
		&lt;head&gt;
			&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
			&lt;title&gt;scaling the background image to browsers window size&lt;/title&gt;
		&lt;/head&gt;
		&lt;body&gt;
			&lt;img src=&quot;images/picture.jpg&quot; id=&quot;background&quot; /&gt;
		&lt;/body&gt;
		&lt;/html&gt;
    </pre>
<p>The above code should be pretty self-explanatory. It is an XHTML document with an inline image in the body, this will serve as the background image for the page.<br />Now, for the content and markup, let's create some DIV elements/sections as seen in the code below:</p>
<pre class="brush: html">
		&lt;div id=&quot;scroller&quot;&gt;
			&lt;div id=&quot;container&quot;&gt;
				&lt;div id=&quot;text-content&quot;&gt;
					&lt;p&gt;
						Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ligula sapien, imperdiet non egestas quis, tristique commodo augue. Nunc vehicula, lacus ac sagittis auctor, sem mauris laoreet neque, sit amet imperdiet enim felis ut enim. Proin vitae ipsum sapien. Donec placerat consequat est, eu dapibus diam vulputate non. Nam ultricies augue in urna aliquam vel posuere nulla tincidunt. Curabitur lectus augue, congue eget sodales vel, elementum eget lectus. Sed eget lobortis elit. Cras vitae rutrum quam. Curabitur eget turpis sit amet ante dignissim auctor ut posuere leo. Vivamus vitae gravida ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris non purus urna. Nunc sit amet sem non est lobortis euismod sodales in ante. Phasellus et nunc nisl.
					&lt;/p&gt;&lt;p&gt;
						Nulla porta velit et libero venenatis ornare. Nam adipiscing interdum libero ac commodo. Proin lacinia elementum ornare. Sed sapien lectus, euismod vitae porta in, iaculis non dolor. Morbi vulputate tincidunt sollicitudin. Morbi sit amet fringilla felis. Nulla vitae tortor et massa convallis dictum quis at ipsum. Vivamus a mi vitae justo aliquam volutpat. Nulla sit amet enim libero. Praesent suscipit, erat in consectetur pretium, ipsum urna hendrerit lorem, sit amet placerat nisi lacus pharetra sem. Proin nec felis vitae lectus hendrerit vestibulum. Sed ullamcorper nunc nec turpis molestie ac semper urna accumsan. Pellentesque eget massa arcu. Vivamus vitae quam ut felis vehicula bibendum et vel sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mollis, sem vitae vulputate pharetra, elit felis aliquet diam, in sagittis enim dui eu justo. Nullam bibendum tincidunt dui eget sollicitudin. Praesent purus orci, suscipit eget sollicitudin in, scelerisque sed sem. Pellentesque et magna neque. Donec vestibulum venenatis arcu, quis pellentesque ipsum laoreet quis.
					&lt;/p&gt;&lt;p&gt;
						Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed malesuada nisi a tellus gravida blandit. Integer id quam ante. Cras non facilisis dui. Phasellus porttitor rhoncus consectetur. Duis nec orci nisi, pulvinar interdum libero. Nulla vel mi volutpat nisi aliquam dapibus sed id velit. Sed commodo pellentesque vulputate. Ut hendrerit orci sit amet mi pellentesque vitae rutrum sapien feugiat. Integer imperdiet quam a massa hendrerit sit amet egestas massa fermentum. Curabitur at massa risus. Mauris aliquet elit id nunc auctor interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam lorem magna, dapibus id volutpat id, pretium id tortor. Morbi pharetra elit lectus, quis semper ipsum. Mauris pulvinar consectetur elementum. Nam ullamcorper nisl et est consequat euismod.
					&lt;/p&gt;&lt;p&gt;
						Maecenas lacus massa, malesuada a pulvinar quis, convallis vel lacus. Sed velit lacus, sodales a accumsan nec, convallis nec justo. Donec vitae orci eu ligula semper tincidunt. Pellentesque facilisis urna et nisl tempus porttitor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec ut interdum erat. Pellentesque rutrum justo eu lectus molestie dictum. Pellentesque scelerisque pulvinar metus sit amet sollicitudin. Nullam nisi elit, hendrerit ut tempor id, volutpat et mauris. In hac habitasse platea dictumst. Phasellus elementum pharetra interdum. Phasellus vel velit vel felis vestibulum interdum a ut turpis. Cras facilisis nisl vel elit rutrum in blandit magna pharetra. Integer nec justo in risus fringilla ornare. Praesent ut erat quis orci fermentum placerat sit amet id purus. Proin nec nulla ligula. Ut nibh elit, pulvinar a porttitor sed, pulvinar id justo. Quisque est dui, facilisis non commodo sed, molestie volutpat justo. Nunc ligula purus, tincidunt et varius sit amet, vehicula vel tortor.
					&lt;/p&gt;&lt;p&gt;
						Duis ut ligula ut augue iaculis porta sed id metus. Duis ultricies tempor orci dapibus convallis. In hac habitasse platea dictumst. Aenean at velit magna, ac hendrerit lorem. Nam facilisis leo in nulla ullamcorper tempus. Duis odio orci, fringilla sed suscipit vel, luctus nec lorem. Maecenas convallis sagittis ultricies. Cras consectetur tristique metus nec tristique. Integer ultricies sem velit, et pulvinar odio. Maecenas quis sollicitudin eros. Ut eget justo non velit tincidunt rhoncus ac eget nunc. Proin quis urna turpis. Pellentesque id mauris diam, id aliquam metus. Curabitur vitae semper mauris. Morbi fringilla pharetra lectus. Ut diam nisl, egestas ac lacinia sed, sodales quis felis. Integer ante enim, interdum eu dictum vitae, sagittis vel tortor. Maecenas dignissim, nisl sed scelerisque molestie, tellus justo fermentum ligula, sit amet venenatis quam turpis quis diam.
					&lt;/p&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	</pre>
<p>There are three separate id containers: scroller, container, and text-content. The 'scroller' is used to move everything inside of it. In this case, the divs and content inside it.<br />
<br />See the preview of your code in your favorite browser.</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/1.JPG" border="0" alt="scaling the background image" /></div>
<p>Scroll down and you will see that the text is below your image, as demonstrated below:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/2.JPG" border="0" alt="scaling the background image"  /></div>
<p>We will now add the necessary CSS that will stretch the image to fit the screen. The image will be stationary and the text will move around if needed.</p>
<pre class="brush: css">
&lt;style type=&quot;text/css&quot;&gt;
html, body {
	margin:0;
	padding:0;
	width:100%;
	height:100%;
	overflow:hidden;
}
#background {
	position:absolute;
	z-index:1;
	width:99%;
	height:100%;
}
#scroller {
	position:absolute;
	width:100%;
	height:100%;
	top:0;
	left:0;
	overflow:auto;
	z-index:2;
}
#container {
	margin-left:25%;
}
#text-content {
	background-color:#CCC;
	width:600px;
	padding:10px;
	margin-top:60px;
}
&lt;/style&gt;
</pre>
<p>Let’s go through the above CSS code step by step.</p>
<pre class="brush: css">
html, body {
	margin:0;
	padding:0;
	width:100%;
 	height:100%;
	overflow:hidden;
}
</pre>
<p>The margin and padding is set to 0 to overwrite the default browser CSS settings. We set the width and height of the image to <code>100%</code> and set overflow to <code>hidden</code>. After applying this above CSS, your page should look like the following:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/3.JPG" border="0" alt="scaling the background image" /></div>
<p>You will notice that there are no scrollbars at right side and all of the text is hidden; This is because of the use of the overflow:hidden property.</p>
<pre class="brush: css">
#background{
	position:absolute;
	z-index:1;
	width:100%;
	height:100%;
}
</pre>
<p>Now, we set both the width and height of the image to 100% for the background to fully stretch to the size of the screen. We will get to why we are using <code>z-index</code> shortly. Using the above snippet, our page now looks like:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/4.JPG" border="0" alt="scaling the background image"  /></div>
<p>Now our background image is fixed to the screen.</p>
<pre class="brush: css">
#scroller{
	position:absolute;
	width:100%;
	height:100%;
	top:0
	left:0;
	overflow:auto;
	z-index:2;
}
</pre>
<p>Styling the scrolling div is pretty simple, <code>z-index</code> is used to place the scroller on top of the background image - the <code>overflow:auto</code> property makes it scrollable when the contents of the scroller take up more room than provided. In other words, the content will be moving while the background is fixed. Let's take a look at the page now:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/5.JPG" border="0" alt="scaling the background image" /></div>
<pre class="brush: css">
#container{
	margin-left:25%;
}

#text-content
{
	background-color:#CCC;
	width:600px;
	padding:10px;
	margin-top:60px;
}
</pre>
<p>In the CSS code above, I've applied some basic styling to the content. The page will now look like:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/6.PNG" border="0" alt="scaling the background image to browser's size" /></div>
<p>You are free to use any of this code according to your needs. It is a nice example to demonstrate how you can stretch an image to the browser's size.</p>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/scaled-background.html" target="_blank" title="Scaling the image background to browsers' window size (e.g.Twitter)">View Scaled Background Demo</a></h2>
<h3>Images and text-indent</h3>
<p>As web developers, we are very used to using multiple images on our websites to achieve certain effects or outcomes.. If you want a professional CSS style, and improved SEO with images, you should write CSS in a separate file instead of via inline-css. Our HTML file will be smaller and search engines will crawl it faster and recognize them better. Let's see an example of using images with CSS in a better way.</p>
<p>Basic HTML markup:</p>
<pre class="brush: html">
	&lt;div id=&quot;map&quot;&gt;This is the map of Pakistan, indicating my city Sialkot. &lt;/div&gt;
</pre>
<p>Preview of above markup:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/7.jpg" border="0" alt="Images and text-indent" /></div>
<p>First, we shall apply some CSS to the above DIV:</p>
<pre class="brush: css">
#map{
	position:relative;
	background-image:url(images/map.jpg);
	background-repeat:no-repeat;
	width:382px;
	height:296px;
}
</pre>
<p>After applying the CSS style, this is what the page looks like:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/8.jpg" border="0" alt="Images and text-indent" /></div>
<p>There is some text on top of the image, which will be crawled by search engines. We need to hide this from the user, though. You may be thinking about using the display:none; property, but, our purpose is to show the text when search engines crawl our webpage. Here is the updated code:</p>
<pre class="brush: css">
#map{
	position:relative;
	background-image:url(map.jpg);
	background-repeat:no-repeat;
	width:382px;
	height:296px;
	text-indent:-9999px;
}
</pre>
<p><code>text-indent:-9999px;</code> is the property used to move the text away from the screen, rather than removing it completely. Click here to see more details on <strong><a href="http://www.w3.org/TR/CSS2/text.html" title="Text-indent at w3.org">text-indent</a></strong>.<br />
<br />Your page will now look something like this:</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/9.jpg" border="0" alt="Images and text-indent" /></div>
<p>Try the <strong><a href="http://chrispederick.com/work/web-developer/" title="Web Developer Firefox plugin">web developer</a></strong> Firefox plug-in to disable the CSS style and then see your website preview</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/10.jpg" border="0" alt="Images and text-indent" /></div>
<blockquote><p>You may know about CSS sprites, that they improve load times and decreases the number of HTTP requests that are made. But using the text-indent property with sprites makes the navigation even more fascinating for SEO as well. If you don't know about CSS sprites then take a look at some of the links below <br />
<a href="http://net.tutsplus.com/videos/screencasts/exactly-how-to-use-css-sprites/" title="CSS Sprites">http://net.tutsplus.com/videos/screencasts/exactly-how-to-use-css-sprites/</a><br />
<a href="http://css-tricks.com/css-sprites/" title="CSS Sprites">http://css-tricks.com/css-sprites/</a></p></blockquote>
<p>In your CSS, you can set the background images and text-indent accordingly.</p>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/text-indent-and-images.html" target="_blank" title="demo of Images and text-indent">View Text Indent Demo</a></h2>
<h3>Z-index in an object tag.</h3>
<h4>What is z-index?</h4>
<p>Elements have 3 positioning dimensions - X (horizontal), Y(vertical) and Z(depth). z-index is how deep down an element is - an element with a higher z-index is placed above an element with a lower z-index. Z-index must be an integer and can only work on elements that have explicitly been given a position property (absolute or relative).</p>
<p>One of my previous issues was fixing the z-index position in an object tag. The solution was very interesting, so let's it now!</p>
<p>Z-Index doesn't work with the object tag. So, after some research and several attempts, I reached a solution which I'll show you here:</p>
<pre class="brush: html">
&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;
  &lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/u1zgFlCw8Aw&amp;rel=1&amp;color1=0x2b405b&amp;
    color2=0x6b8ab6&amp;border=1&amp;fs=1&quot;&gt;&lt;/param&gt;
  &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;
  &lt;embed wmode=&quot;transparent&quot; src=&quot;http://www.youtube.com/v/u1zgFlCw8Aw&amp;rel=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6&amp;border=1&amp;fs=1&quot;
    type=&quot;application/x-shockwave-flash&quot;
    width=&quot;425&quot; height=&quot;355&quot;
    allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;
	&lt;/object&gt;
</pre>
<p>In the embed tag, you will notice that I used the <b>wmode="transparent"</b> property. This sets the video into transparent mode. For flash files, see the below snippet:</p>
<pre class="brush: html">
&lt;object id=&quot;FlashID&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;660&quot; height=&quot;95&quot;&gt;
    &lt;param name=&quot;movie&quot; value=&quot;Flash-banner.swf&quot;&gt;
    &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;
    &lt;param name=&quot;wmode&quot; value=&quot;opaque&quot;&gt;
    &lt;param name=&quot;swfversion&quot; value=&quot;8.0.35.0&quot;&gt;
    &lt;!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --&gt;
    &lt;param name=&quot;expressinstall&quot; value=&quot;Scripts/expressInstall.swf&quot;&gt;
    &lt;!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --&gt;
    &lt;!--[if !IE]&gt;--&gt;
    &lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;Flash-banner.swf&quot; width=&quot;660&quot; height=&quot;95&quot;&gt;
      &lt;!--&lt;![endif]--&gt;
      &lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;
      &lt;param name=&quot;wmode&quot; value=&quot;opaque&quot;&gt;
      &lt;param name=&quot;swfversion&quot; value=&quot;8.0.35.0&quot;&gt;
      &lt;param name=&quot;expressinstall&quot; value=&quot;Scripts/expressInstall.swf&quot;&gt;
      &lt;!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --&gt;
      &lt;div&gt;
		&lt;h4&gt;Content on this page requires a newer version of Adobe Flash Player.&lt;/h4&gt;
		&lt;p&gt;&lt;a href=&quot;http://www.adobe.com/go/getflashplayer&quot;&gt;&lt;img src=&quot;http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif&quot; alt=&quot;Get Adobe Flash player&quot; width=&quot;112&quot; height=&quot;33&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
      &lt;/div&gt;
      &lt;!--[if !IE]&gt;--&gt;
    &lt;/object&gt;
    &lt;!--&lt;![endif]--&gt;
  &lt;/object&gt;
</pre>
<p>This part of the code is quite interesting, so I would suggest that you try viewing the page with and without these tags.</p>
<pre class="brush: html">  &lt;param name=&quot;wmode&quot; value=&quot;opaque&quot;&gt;</pre>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/z-index-objects-tag.html" target="_blank" title="demo of Z-index in an object tag">View Z-Index Object Demo</a></h2>
<h3>CSS Shadows</h3>
<p>If your job is to convert PSD to XHTML/CSS you must be dealing with shadows of images in the PSD that you are going to work on. You must be looking some solution to apply the shadows in CSS instead of taking the images from PSD. Applying shadows to images/text via CSS is a good way to reduce your file size.
</p>
<p></p>
<p>There are two CSS3 properties to give shadows in web pages:</p>
<p>1. Text-shadow</p>
<p>2. Box-shadow</p>
<h4>Text-shadow:</h4>
<p>If you want to give shadow to your Text in webpage then use the text-shadow css3 property.Let's move step by step to achieve this goal.</p>
<p>1. Wrap the text with a DIV, as seen below:</p>
<pre class="brush: html">
            &lt;h2&gt;Text Shadow&lt;/h2&gt;
            &lt;div class=&quot;txt_shadow&quot;&gt;
                            Envato - Nettuts+
            &lt;/div&gt;
</pre>
<p>2. Here is the css style that is used to give shadows to above text:</p>
<pre class="brush: css">
h2{
color:#FF0000;
text-decoration:underline;}
.txt_shadow{
font-size:38px;
font-family:Verdana, Arial, Helvetica, sans-serif;
text-shadow:2px 12px #999;  /*x-axis y-axis color*/
}
</pre>
<p>Above css style is pretty simple to follow, text-shadow property is used for styling the text shadows. It takes 2 arguments. 1st is x-axis that scales the shadow to right side. 2nd is the y-axis that scales the shadow to down. If we set the negative value to x-axis it will scale the shadow to left and if we set the y-axis to negative it will scale the shadow to up.After applying the above html/css your text shadow will look alike below: </p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/singletext.jpg" border="0"  width="600" alt="Text Shadow"/></div>
<p>3. Let's make this more attracting by adding the blur to shadow.</p>
<pre class="brush: html">
&lt;h2&gt;Text Shadow with blur&lt;/h2&gt;

&lt;div class=&quot;txt_blur_shadow&quot;&gt;
	Envato - Nettuts+
&lt;/div&gt;
</pre>
<pre class="brush: css">
.txt_blur_shadow{
font-size:38px;
font-family:Verdana, Arial, Helvetica, sans-serif;
text-shadow:2px 2px 5px #999;  /*x-axis y-axis blur color*/
}
</pre>
<p>See the text-shadow property clearly. We added 4 arguments now. 3rd one is new that is used to blur the shadow. After applying the above styling the resulting text will be </p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/singletextblur.jpg" border="0"  width="600" alt="Text Shadows with blur"/></div>
<p>Looks pretty clean with blur <img src='http://dev-tips.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Isn’t it ? </p>
<p>4. You can add even multiple shadows to your text. Its CSS style will be </p>
<pre class="brush: css">
.txt_multiple_shadow{
font-size:38px;
font-family:Verdana, Arial, Helvetica, sans-serif;
text-shadow:2px 12px #999,5px -5px #999;  /* 1st style[x-axis y-axis color], 2nd style[x-axis y-axis color] */
}
</pre>
<p>See the text-shadow property; we used multiple styles of shadows separated by commas. You can even use blur with it too.  After adding the above style it will look alike this </p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/multipleshadowtext.jpg" border="0"  width="600" alt="CSS Multiple Text Shadows"/></div>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/css-shadows-text.html" target="_blank" title="demo of CSS Text Shadows">Click here to view the demo </a></h2>
<h4>Box-shadow:</h4>
<p>The great way to give a shadow to an image in your webpage is use box-shadow property. Let’s see how to style the image shadows.</p>
<p>1. Take a picture of which you want to apply drop shadow. I selected a picture of my son <img src='http://dev-tips.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>2. Wrap the image with a DIV, as seen below:</p>
<pre class="brush: html">
&lt;h2&gt;Image Shadow&lt;/h2&gt;

&lt;div class=&quot;img_blur_shadow&quot;&gt;
	&lt;img src=&quot;http://dev-tips.com/post_img/adnan/11.jpg&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;380&quot;   /&gt;
&lt;/div&gt;
</pre>
<p>3. CSS style to apply shadow to above markup </p>
<pre class="brush: css">
.img_blur_shadow{
width:540px;
height:380px;
border:1px solid #000000;
padding:2px;
box-shadow:1px 1px 10px #999;  /*[x-axis y-axis blur color]*/
-moz-box-shadow:1px 1px 10px #999;
-webkit-box-shadow:1px 1px 10px #999;
}
</pre>
<p>Box-shadow property cannot be recognized by every browser. So, we used –moz-box-shadow for Firefox and –webkit-box-shadow property for chrome/web kit engines. Arguments for box-shadow are same like text-shadow.  Output of above html/css markup will be </p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/singleshadowimage.jpg" border="0"  width="587" alt="My Son and Me in CSS Image Shadows"/></div>
<p>4. Even, you can drop multiple shadows, like we have seen previously for text, for images also.HTML/CSS will be </p>
<pre class="brush: html">
&lt;h2&gt;Multiple Image Shadows&lt;/h2&gt;

&lt;div class=&quot;img_multiple_shadow&quot;&gt;
	&lt;img src=&quot;images/174955.jpg&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;380&quot;   /&gt;
&lt;/div&gt;
</pre>
<pre class="brush: css">
.img_multiple_shadow{
width:540px;
height:380px;
border:1px solid #000000;
padding:2px;
box-shadow:1px 1px 10px #999,1px 1px 10px red;  /*[x-axis y-axis blur color]*/
-moz-box-shadow:1px 1px 10px #999,1px 1px 10px red;
-webkit-box-shadow:1px 1px 10px #999,1px 1px 10px red;
}
</pre>
<p>The above code is pretty easy to understand if you have followed how to multiple shadows with text. It has same number of arguments and you can use number of multiple shadows separated by commas.</p>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/css-shadows_image.html" target="_blank" title="demo of CSS Image Shadows">View CSS Shadows Demo</a></h2>
<h3>CSS UI Enhancements</h3>
<p>While working on my latest project, I had a few strange issues I was running into. First of all, when I try to select the text in Firefox it didn't turn blue like in IE Browsers. Secondly, when the user clicks on a link, an dotted outline appears around the link. This was especially annoying because I was using text-indent with the links.</p>
<h4>Text Selection Highlight Color</h4>
<p>To create a highlight color when text is selected, I use the following code:</p>
<pre class="brush: css">
/*Mozilla browser selection*/
::-moz-selection{
	background: #69f;
	color:#fff;
}
/*Other browsers selection except IE */
::selection {
	background:#69F;
	color:#fff;
}
</pre>
<h4>Remove Border Outline around links</h4>
<p>I went over some popular websites and was shocked when I saw they had the same problem - an outline appears around the link. A few of the popular websites are listed below with their screen shots.</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/13.PNG" border="0" alt="sitepoint outline issue" /></div>
<p>Even the BBC website is facing this issue.</p>
<div class="tutorial_image"><img src="http://dev-tips.com/post_img/adnan/14.PNG" border="0" alt="BBC outline issue" /></div>
<p>So the solution for removing this outline is:</p>
<pre class="brush: css">
a:link, a:hover, a:visited{
	outline:none;
}
</pre>
<h4>Attribute-Specific Icons</h4>
<p>Do you want to have file icons next to your links? Add PDF icons next to your .PDF links, MS WORD icons next to your .doc links, so on and so forth. This is a great way to make links describe what they're pointing to.<br />The code for specifying the attribute icons is:</p>
<pre class="brush: css">
a[href$=&#039;.pdf&#039;]{
	padding:0 20px 0 0;
	background-image:url(images/Print.ico);
	background-position:right;
	background-repeat:no-repeat;
}
a[href$=&#039;.doc&#039;]{
	padding:0 20px 0 0;
	background-image:url(images/docs.ico);
	background-position:right;
	background-repeat:no-repeat;
}
</pre>
<h2 class='box demo'><a href="http://dev-tips.com/demo/5advancedCSS/ui.html" target="_blank" title="demo of CSS user interface enhancements">View UI Demo</a></h2>
<h3>Conclusion</h3>
<p>In this tutorial, we have learned the advanced techniques of CSS that can solve some tricky issues. Luckily, most if not all of these techniques are easy to understand and implement. If you know of any other techniques to solve these problems, please share them with the world and post them in the comments area.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/5-advanced-css-techniques-to-increase-your-skill-set/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>CSS Tip: How to Make Circles Without Images</title>
		<link>http://dev-tips.com/featured/css-tip-how-to-make-ircles-without-images</link>
		<comments>http://dev-tips.com/featured/css-tip-how-to-make-ircles-without-images#comments</comments>
		<pubDate>Mon, 04 May 2009 02:53:28 +0000</pubDate>
		<dc:creator>Vasili</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=403</guid>
		<description><![CDATA[About a month ago, Jeffery Way posted an article about creating shapes with pure CSS, no images added. I've been using the CSS3 property of border radius a lot in a design I've been working on and thought, "why can't I use this to make circles?" Today, I'll show you how to make your very [...]]]></description>
			<content:encoded><![CDATA[<p>About a month ago, <a href="http://net.tutsplus.com/videos/screencasts/fun-with-css-shapes/">Jeffery Way</a> posted an article about creating shapes with pure CSS, no images added. I've been using the CSS3 property of border radius a lot in a design I've been working on and thought, "why can't I use this to make circles?" Today, I'll show you how to make your very own CSS circles. In addition, we will use our new knowledge to create a simple jQuery plugin!</p>
<p><span id="more-403"></span></p>
<h2 class='box demo'><a href='http://dev-tips.com/demo/css3_circles.html' title='CSS 3 Circles Demo' target='_blank'>View Demo</a></h2>
<h3>Structure, structure, structure!</h3>
<p>How are we suppose to make a circle without any HTML to style? Because this is just a simple shape, I'll be using an "empty" span tab — I've just put &amp;nbsp; into it.</p>
<pre class="brush: html">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;

&lt;title&gt;CSS Circle&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
* {
margin: 0;
padding: 0;
}
body {
margin: 1in;
}
.circle {
/* Everything else goes here. */
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;span class=&quot;circle&quot;&gt;&amp;amp;amp;nbsp;&lt;/span&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>I'll be using inline CSS because this is just a demo, but if this were for a project you'd probably want to put it in an external style sheet. I've also reset the margins and padding, then gave the body a one inch margin to push our circle away from the sides of the page.</p>
<h3>Basic Styles</h3>
<p>For now, I'll give the circle a background of #333 just so we can see it. You'll also want to give it the same height and width, this is the length of the diameter. The size doesn't really matter just make sure it's <strong>en even number</strong>.</p>
<pre class="brush: css">
.circle {
display: block;
width: 80px;
height: 80px;
background: #333;
}
</pre>
<p><em>Note: If you're using an inline element (like a span tag), you'll want to give the element a display of "block". If you don't know if your element is a block level element or not, just load the file in a web browser and if it's height and width look larger than 1px it is.</em></p>
<h3>Circles Are Really Made With CSS3</h3>
<p>What really gives this circle its arcs is CSS3's <a href="http://www.css3.info/preview/rounded-border/">-moz-border-radius and -webkit-border-radius</a> properties. What we're going to have to do is give the border radius a value of <strong>half the height/width</strong>; this is the radius of the circle. For my example, I've used 80px for the height and width so I'll set the border radius to 40px.</p>
<pre class="brush: css">
.circle {
display: block;
display: block;
width: 80px;
height: 80px;
background: #333;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
}
</pre>
<h3>Conclusion</h3>
<p>CSS3 is a very powerful tool to know how to use. Just make sure you don't base your entire website around it because not every browser supports it yet. However, if you can get the effect in certain browsers and still have you're design looking okay in other browsers, I think it's fine to use browser specific styles.</p>
<h3>Create a jQuery Plugin For Our Circles</h3>
<p>You can also take this a step further by making it into a jQuery plugin.</p>
<pre class="brush: js">
(function($){

	$.fn.jCircle = function(options) {
		var defaults = {
			size: 40
		},
			settings = $.extend({}, defaults, options);

		settings.size = parseInt(settings.size) || 40;
		settings.radius = (settings.size/2) + &#039;px&#039;;

		return this.each(function(){
			var $this = $(this);

			$this.css({
				display: &#039;block&#039;,
				width: settings.size + &#039;px&#039;,
				height: settings.size + &#039;px&#039;
			});

			$this.css(&#039;-moz-border-radius&#039;, settings.radius);
			$this.css(&#039;-webkit-border-radius&#039;, settings.radius);
		});
	}

})(jQuery);
</pre>
<h2 class='box demo'><a href='http://dev-tips.com/demo/css3_circles.html' title='CSS 3 Circles Demo' target='_blank'>View Demo</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/css-tip-how-to-make-ircles-without-images/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Javascript Tip: Easy Fading Using jQuery</title>
		<link>http://dev-tips.com/featured/javascript-tip-easy-fading-using-jquery</link>
		<comments>http://dev-tips.com/featured/javascript-tip-easy-fading-using-jquery#comments</comments>
		<pubDate>Thu, 30 Apr 2009 22:29:49 +0000</pubDate>
		<dc:creator>John Bloomfield</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=365</guid>
		<description><![CDATA[Whilst working on a project recently I came across a need for us to show a selection of images depending on their type and when a link to them is clicked. I decided to use jQuery as it saves a lot of time as most of the work is done for you. I will step [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst working on a project recently I came across a need for us to show a selection of images depending on their type and when a link to them is clicked. I decided to use jQuery as it saves a lot of time as most of the work is done for you. I will step through the code so you can see how I did it.
</p>
<p><span id="more-365"></span></p>
<h3><a href='http://dev-tips.com/demo/fading/' target='_blank'>View Demo</a></h3>
<p>As with any jQuery, we are required to use the following line to tell our jQuery code to run as soon as DOM is ready rather than when the page has finished loading.</p>
<pre class="brush: js">
$(document).ready(function(){
</pre>
<p>The next line detects any click from a link inside the div with an id of “links”</p>
<pre class="brush: js">$(&#039;#links a&#039;).click(function(){</pre>
<p>Once a link has been clicked any attribute from that link is accessible through $(this), so the next line sets up a new variable called “color” and takes the “rel” attribute from the tag and puts it into our new variable.</p>
<pre class="brush: js">var color = $(this).attr(&#039;rel&#039;);</pre>
<p>Once we know which colour link has been clicked we can then fade out all images that have a different colour and fade in the colour that has been clicked.</p>
<pre class="brush: js">
$(&#039;#tiles div.tile:not(.&#039; + color + &#039;) img&#039;).fadeTo(&quot;slow&quot;, 0.3);
$(&#039;#tiles div.&#039; + color + &#039; img&#039;).fadeTo(&quot;slow&quot;, 1);
</pre>
<p>To finish off we need to close our function brackets. You will notice there is a “return false;”. This is to stop the link actually activating the href attribute and basically overriding it so we can do our magic. This becomes useful when users don’t have Javascript activated in there browser, you can make the link work as normal. Unfortunately, you would need to create separate pages with different colours highlighted instead. (sigh!)</p>
<p>So, to sum up I have put all the code below and you will need to remember to include the latest jQuery Javascript file from <a href='http://jquery.com'>www.jquery.com</a><br />
All the HTML you can grab from the source of the demo page.</p>
<h2>Final Code</h2>
<pre class="brush: js">
$(document).ready(function(){
   $(&#039;#links a&#039;).click(function(){
      var color = $(this).attr(&#039;rel&#039;);
      $(&#039;#tiles div.tile:not(.&#039; + color + &#039;) img&#039;).fadeTo(&quot;slow&quot;, 0.3);
      $(&#039;#tiles div.&#039; + color + &#039; img&#039;).fadeTo(&quot;slow&quot;, 1);
   });
   return false;
});
</pre>
<p>Hopefully, this will be useful to someone. Have fun!</p>
<h3><a href='http://dev-tips.com/demo/fading/' target='_blank'>View the Demo</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/javascript-tip-easy-fading-using-jquery/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>An Interview with Chris Coyier</title>
		<link>http://dev-tips.com/featured/an-interview-with-chris-coyier</link>
		<comments>http://dev-tips.com/featured/an-interview-with-chris-coyier#comments</comments>
		<pubDate>Thu, 19 Feb 2009 01:00:06 +0000</pubDate>
		<dc:creator>Drew Douglass</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=193</guid>
		<description><![CDATA[I recently had the absolute pleasure of interviewing one of my favorite internet heroes, Chris Coyier of CSS-Tricks.com. Chris is a web designer and developer and you have probably seen his stuff all over the net. The interview was conducted on the famous NETTUTS.com and I encourage you all to check out the interview and [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the absolute pleasure of interviewing one of my favorite internet heroes, Chris Coyier of <a href='http://css-tricks.com'>CSS-Tricks.com</a>. Chris is a web designer and developer and you have probably seen his stuff all over the net. The interview was conducted on the famous <a href='http://nettuts.com'>NETTUTS.com</a> and I encourage you all to <a href='http://net.tutsplus.com/articles/interviews/chatting-with-chris-coyier/'>check out the interview</a> and let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/an-interview-with-chris-coyier/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ID Your BODY: A Simple CSS Trick With a lot of ROI</title>
		<link>http://dev-tips.com/featured/id-your-body-a-simple-css-trick-with-a-lot-of-roi</link>
		<comments>http://dev-tips.com/featured/id-your-body-a-simple-css-trick-with-a-lot-of-roi#comments</comments>
		<pubDate>Fri, 30 Jan 2009 23:33:00 +0000</pubDate>
		<dc:creator>Brian Cray</dc:creator>
				<category><![CDATA[Client Side]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[HTML/CSS]]></category>

		<guid isPermaLink="false">http://dev-tips.com/?p=161</guid>
		<description><![CDATA[One of the latest raves in Web design is to add an id attribute to the body tag, like &#60;body id="coolpage"&#62;. It's a small thing, but it's a damn good idea! Why? Let's say you have 15 pages total on your Geocities Star Wars fan site. You want the headlines (&#60;h1&#62;Headline!&#60;/h1&#62;) to be 16 px [...]]]></description>
			<content:encoded><![CDATA[<p>One of the latest raves in Web design is to add an id attribute to the body tag, like <code>&lt;body id="coolpage"&gt;</code>. It's a small thing, but it's a damn good idea!</p>
<p>Why? Let's say you have 15 pages total on your <strong>Geocities Star Wars fan site</strong>. You want the headlines (<code>&lt;h1&gt;Headline!&lt;/h1&gt;</code>) to be 16 px in size with the exception of the home page. On the homepage you want the headlines to be 18px and <strong>bold</strong>!</p>
<p>Will you make a new separate CSS file just for the homepage that the user has to download in addition to the default CSS? NO! You're too good for that! You &amp; C3PO hang out on the weekends.</p>
<p><span id="more-161"></span></p>
<p>Instead of all that extra CSS file nonsense, you can use <code>&lt;body id="homepage"&gt;</code> in replacement of <code>&lt;body&gt;</code>, which enables you to assign unique CSS <em>only</em> to the homepage like so:</p>
<pre class="brush: css">
/* for all pages */
h1 { font-size: 16px; }

/* for homepage only */
#homepage h1 { font-size: 18px; font-weight: bold; }
</pre>
<p>And BOOM! Your homepage headlines are styled differently without any hacks or additional files. <strong>That's awesome and incredibly useful.</strong></p>
<p>So why not stop there? Because adding id attributes to the body element of each page takes time and work. When you start that new section on your Geocities Star Wars fan site about Princess Layla's secret love affair with R2D2, you'll be adding lots of id attributes for all the juicy pages. It'll be redundant and boring.</p>
<p>Let's use PHP to make things A LOT easier. Use the following line in replacement of <code>&lt;body&gt;</code> and your pages will automatically have id tags based on their filenames.</p>
<pre class="brush: php">
&lt;body id=&quot;&lt;?php echo (str_replace(&#039;/&#039;, &#039;_&#039;, substr($_SERVER[&#039;REQUEST_URI&#039;], 1, strlen($_SERVER[&#039;REQUEST_URI&#039;]) - strrpos($_SERVER[&#039;REQUEST_URI&#039;], &#039;.&#039;) - 1)) ? str_replace(&#039;/&#039;, &#039;_&#039;, substr($_SERVER[&#039;REQUEST_URI&#039;], 1, strlen($_SERVER[&#039;REQUEST_URI&#039;]) - strrpos($_SERVER[&#039;REQUEST_URI&#039;], &#039;.&#039;) - 1)) : &#039;index&#039;); ?&gt;&quot;&gt;
</pre>
<p>There you have it. Use that line in your HTML template, and your pages will have id attributes assigned to <code>&lt;body&gt;</code> automagically. Yippy!</p>
<p>For example, c3po.php will become #c3po, c3po/loveaffairs.php will become #c3po_loveaffairs (forward slashes "/" are replaced with underlines "_"), and your homepage will be #index. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev-tips.com/featured/id-your-body-a-simple-css-trick-with-a-lot-of-roi/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
