<?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>Tutorial9 &#187; Ryan Hickman</title>
	<atom:link href="http://www.tutorial9.net/author/ryanhickman/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tutorial9.net</link>
	<description>Tutorial Bliss.</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Quick &amp; Easy CSS Development with Firebug</title>
		<link>http://www.tutorial9.net/tutorials/web-tutorials/quick-easy-css-development-with-firebug/</link>
		<comments>http://www.tutorial9.net/tutorials/web-tutorials/quick-easy-css-development-with-firebug/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 15:41:23 +0000</pubDate>
		<dc:creator>Ryan Hickman</dc:creator>
				<category><![CDATA[Web Development Tutorials]]></category>

		<guid isPermaLink="false">http://www.tutorial9.net/?p=3540</guid>
		<description><![CDATA[With Firebug, one can rapidly make changes to CSS making cross-browser website compliance a breeze. These tips and tricks will show you how to get started, and how to use Firebug to live edit your CSS code.]]></description>
			<content:encoded><![CDATA[<p><!--adsense#300--></p>
<p class="important">In the past, I found myself spending countless hours tweaking my CSS and making everything work in Internet Explorer just as it would in Firefox. Everything changed when I found Firebug. In this tutorial, I am going to discuss how to use Firebug to make CSS development faster, and share some tips for a consistent look between browsers.</p>
<div class="toc" id="toc">
<p><span class="label">Quick Nav:</span></p>
<ul>
<li><a href="#1">Installing and Getting around Firebug </a></li>
<li><a href="#video">Live editing of CSS using Firebug </a></li>
<p><!-- If it's a Web Tutorial --></p>
<li><a href="#2">Firebug for Internet Explorer</a></li>
</ul>
</div>
<h3>Materials Needed:</h3>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug (for Mozilla Firefox) </a></li>
<li>Web Editor (Dreamweaver, Aptana, Notepad++, etc) </li>
</ul>
<h3 id="1">Part 1: Installing and Getting Around Firebug </h3>
<p>If you haven&#8217;t installed Firebug yet, Please go to the Mozilla plug-in directory, download and install: The link can be found here:</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/1843"><strong>https://addons.mozilla.org/en-US/firefox/addon/1843</strong></a></p>
<p>Now, the Firebug is installed its time to understand what we&#8217;re looking at, and how we can use it. First, lets navigate to Tutorial9.net so we are all working with the same example. </p>
<p>Next click on the <strong>little bug in the bottom right corner of your browser (see photo below). </strong></p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/1.jpg" alt="Image Description" width="600" height="127" /></div>
<p>You&#8217;ll see the firebug window expand. And you&#8217;ll see the menu below. In the top menu you will see <strong>Inspect </strong>and <strong>Edit. Click on Inspect.</strong> If you mouse over the  website, you will see a blue box outline around whichever html object you hover over. </p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/2.jpg" alt="Image Description" width="600" height="127" /></div>
<p>Now, when you click an element you will see that the right side of the firebug window show the CSS elements and attributes of that item. <strong>For our example we&#8217;re going to click inspect and select the tutorial9.net logo.</strong> </p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/3.jpg" alt="Image Description" width="600" height="127" /></div>
<p>Once you select the element, look in the bottom right hand corner of your firebug window. Here you will see the CSS elements and attributes of those elements that relate to the object you selected in the web site. To the right of each element you will see the Location of the CSS element in the document as well as the line it appears on.</p>
<p>So using our example, The Tutorial9.net logo inherits its CSS styles from ID masthead (#masthead) in Styles.CSS on line 54.  </p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/4.jpg" alt="Image Description" width="600" height="127" /></div>
<h3 id="2">So lets Play around a little but: </h3>
<p>Move your mouse over the value of the margin property, and change 0 to 38px, Notice when you change the value, the appearance in the live document instantly change as well.</p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/5.jpg" alt="Image Description" width="600" height="127" /></div>
<div class="tip">
<h4>Element, Attributes and Properties???? </h4>
<p>The Red &#8211; CSS Element (Class, ID, or Tag)<br />
  The Blue &#8211; Element Property (Margin, Width, Height, Etc)<br />
The Teal &#8211; Property Value </p>
<p> <img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/6.jpg" alt="Image Description" width="300" height="127" /></p>
</div>
<p>Now, if you play with the properties you can preview your CSS in a live browser environment, saving you from jumping back and forth between your doucment editor, browser and ftp server. </p>
<p>Moving on, If you mouse over an element title and right click you have the ability to <strong>add a new property</strong>, to adjust the CSS element as well. </p>
<div class="image-container full"><img src="http://tutorial9.s3.amazonaws.com/uploads/2009/02/7.jpg" alt="Image Description" width="600" height="127" /></div>
<h3 id="video">Part 2: Edit YOUR web page&#8217;s CSS with firebug </h3>
<p>Now that we understand firebug, and what it does, its time to dig into how we can use it to edit CSS in your document. </p>
<p>Open your webpage in firefox. Select the first element you wish to modify. Add/Remove/Modify properties until the element is positioned the way you want. Once you get the look you want, <strong>select the properties</strong>, <strong>select copy, open your document editor navigate to the appropriate line paste the new properties, save and reopen in your browser. </strong>You will see the new changes.</p>
<p>In the video below you can see how to I use firebug to adjust various objects in my live document.</p>
<div class="video-step">
<object width="600" height="400"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3217224&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3217224&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="400"></embed></object><br /><a href="http://vimeo.com/3217224">Tutorial on Using Firebug</a> from <a href="http://vimeo.com/user583918">Ryan Hickman</a> on <a href="http://vimeo.com">Vimeo</a>.
</div>
<h3>Part 3: Firebug and Internet Explorer </h3>
<p>Of course, like many &#8212; I am not an advocate of Internet Explorer &#8212; sad thing is there are still many internet explorer users out there.<em> As a developer, I&#8217;ve been in a few instantces where I&#8217;ve prepared a website for a client who works for a government agency, and the agency has a contract to only use internet explorer at their offices &#8211; So I found that</em> <em>I HAD to build for ie6. I also learned how many people (which there are a lot) that still use IE and how many of those IE users still use IE6.</em> </p>
<p>Of course the Firefox plugin doesn&#8217;t work for Internet Explorer, so you have to use &#8216;FireBug Lite&#8217;. Which a very lightweight JS script that you embed in your code while developing, and remove when your all set. Here&#8217;s how, In your header insert the following code: </p>
<pre name="code" class="css" style="overflow: auto;"> &lt;script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'&gt;&lt;/script&gt;</pre>
<p>If you need to adjust the size of the firebug window you can by inserting the following script, below the one above: </p>
<pre name="code" class="css" style="overflow: auto;">&lt;script type=&quot;text/javascript&quot;&gt;
	firebug.env.height = 500;
&lt;/script&gt;  </pre>
<div class="tip">
<p>For those of you who are developing on your local machine, you can <a href="http://getfirebug.com/releases/lite/1.2/">download firebug lite here</a>. Note: you must replace your script with the follow: </p>
<pre name="code" class="css" style="overflow: auto;"> &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;/path/to/firebug/firebug-lite.js&quot;&gt;&lt;/script&gt;</pre>
</div>
<p><!-- It looks nice when actually on Tutorial9.net. I've just limited styling here --></p>
<p>Working with firebug in internet explorer is a bit different functionaility wise, as once you make change to your CSS, you have to manually run the CSS changes from the firebug consul window. Aside that, Its the same principals as developing for Firefox. </p>
<h3>Part 4:The CSS Im using works in Firefox but Not IE </h3>
<p>Okay &#8212; we&#8217;re making progress, but it seems some CSS properties <strong>Dont look the same in Firefox as they do in Internet Explorer. </strong> </p>
<h3>1. Conditional Styles</h3>
<p>Since IE is very quirky and non-compliant with w3 Schools CSS standards, often you must create a custom style sheet, <strong>that only loads when the user is browsing from that particular version of internet explorer</strong>.To do so, simply add the following code to the &lt;head&gt; of your document. </p>
<pre name="code" class="css" style="overflow: auto;">
&lt;!--[if IE]&gt;	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ie.css&quot; /&gt;&lt;![endif]--&gt; </h3>
</pre>
<p>In between the tags, you can place CSS code or, like the above example link to an external stylesheet. Any code you place in between the tags will appear if the tags are true. The script below shows a DIV only if the user is using IE6.</p>
<pre name="code" class="css" style="overflow: auto;">
&lt;!--[if IE 6]&gt;	&lt;div id=&quot;ie6&quot;&gt;
		We reccommend that you upgrade to at least Interent Explorer 7
	&lt;/div&gt;
&lt;![endif]--&gt; </h3>
</pre>
<div class="tip">
<p>Here are a few other Conditions:</p>
<ul>
<li>IE (Any version of Internet Explorer)</li>
<li>lt IE 7 (Versions less than version)</li>
<li>lte IE 6(Versions less than or equal to version)</li>
<li>IE 6 (Only version)</li>
<li>gte IE 6 (Versions greater than or equal to version)</li>
<li>gt IE 7 (Versions greater than version)</li>
</ul>
</div>
<h3>2. Opacity</h3>
<p>Did you know you CAN do opacity in Internet Explorer with a Javascript. Many people don&#8217;t know how. Its every simple. In Firefox you use the property <strong>Opacity. </strong>When in IE you use <strong>filer: alpha(opacity = value);</strong> as show in the code below: </p>
<pre name="code" class="css" style="overflow: auto;">.logo {
	opacity: 0.5;  //For Firebox
	filter: alpha(opacity = 50); //For Internet Explorer
}</pre>
<pre name="code" class="css" style="overflow: auto;">
&lt;!--[if IE]&gt;	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ie.css&quot; /&gt;&lt;![endif]--&gt; </h3>
</pre>
<p>In between the tags, you can place CSS code or, like the above example link to an external stylesheet. Any code you place in between the tags will appear if the tags are true. The script below shows a DIV only if the user is using IE6.</p>
<pre name="code" class="css" style="overflow: auto;">
&lt;!--[if IE 6]&gt;	&lt;div id=&quot;ie6&quot;&gt;
		We reccommend that you upgrade to at least Interent Explorer 7
	&lt;/div&gt;
&lt;![endif]--&gt; </h3>
</pre>
<h3>3. IE6 Scroll Renders Artifact </h3>
<p> What happens is IE6 (which again sadly, people still use) is when scrolling vertically down the page, artifacts make the page look all messed up. What is happening is a DIV element that has nothing behind it on the page is rendered bit by bit  (for efficiency says Microsoft) as the page scrolls. If the scrolling is anything  other than 100% smooth the rendering fails leaving the sorts of  glitches shown above. To fix, we have to insert a null object behind the DIV. Simple fix, see blow: </p>
<pre name="code" class="css" style="overflow: auto;">html {
	background : url(null) fixed no-repeat;
    }
</pre>
<h3>4. Min-Width and Min-Height Issues </h3>
<p>IE doesn’t understand these commands, so to make this work, you&#8217;ll need to use conditions to access customs styles to make it work in Internet Explorer. So Lets say we have a div called wrapper: </p>
<pre name="code" class="css" style="overflow: auto;">#wrapper{
	min-width: 750px;
	width:expression(
		document.body.clientWidth &lt; 750? &quot;750px&quot;: &quot;auto&quot;
	);
} </pre>
<h3>5. A:Hover, Button:Hover &#8212; Hover Issues </h3>
<p> :hover  enables you to have cool effects for HTML elements  like button rollovers, etc. Most browsers have no problem with this, except IE (once again of course) which look at the stylesheets and each individual rule with Javascript.<br />
If :hover rules can be tracked, and .htc can be used to change an  elements behavior, then it should be possible to create a behavior that  enables :hover for any element in IE.</p>
<p>In my building I&#8217;ve found the only effective work-around is using a small JS file.  Which you insert like below: </p>
<pre name="code" class="css" style="overflow: auto;">  body {
	behavior: url(&quot;csshover3.htc&quot;);
}  </pre>
<p><strong>You can download the csshover3.htc file here. <br />
    <a href="http://tutorial9.s3.amazonaws.com/uploads/2009/02/csshover3.htc">Unpacked (9k)</a></strong></p>
<p><a href="http://tutorial9.s3.amazonaws.com/uploads/2009/02/csshover3-packed.htc">Packed (2.5k)</a> </p>
<h3>6. Margin + Centering your Div </h3>
<p>When centering DIV tags using either the margin-left: auto; or  margin-right: auto; settings, <strong>will not work in Internet explorer</strong>. Your would have to conditionally add the following code:</p>
<pre name="code" class="css" style="overflow: auto;">#divname {	text-align: center;}</pre>
<p><strong>Note: IF YOU MAKE THE DIV CENTER, YOU MUST RE-ADJUST THE INNER CONTENT </strong></p>
<pre name="code" class="css" style="overflow: auto;">#p {	text-align: left;}</pre>
<h3>7. Margins Too Large </h3>
<p>I hate this one the most. Setting the margin attribute for any CSS  element in Internet Explorer  will often appear with added width, which can seriously mess up detailed layouts. By using the {display: inline;} property/value on the tag containing your margin setting can fix this </p>
<pre name="code" class="css" style="overflow: auto;">&lt;div id=&quot;special&quot; style=&quot;display: inline; margin-left: 10px;&quot;&gt;&lt;/div&gt;</pre>
<h3>8. Lightbox&#8217;s (modal boxes) don&#8217;t hide Flash underneath </h3>
<p>Everyone is using Lightbox script&#8217;s nowadays. If ever your running into the problem of a flash element (swf or even a video) and you want the flash element to continue to play&#8230; heres how: </p>
<pre name="code" class="css" style="overflow: auto;">&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;/&gt;</pre>
<p>If your using SWFObject:</p>
<pre name="code" class="css" style="overflow: auto;">	so.addParam(&quot;wmode&quot;,&quot;transparent&quot;);</pre>
<h3 id="2">Final Thought:</h3>
<p>Dont test User-Agents to detect the users Browser, cause Google will look at that as Cloaking and ban your site, believe me, I know ;)</p>
<p>Got any tips to add that I may have missed? Please share in the comments below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorial9.net/tutorials/web-tutorials/quick-easy-css-development-with-firebug/feed/</wfw:commentRss>
		<slash:comments>125</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching using disk
Object Caching 168/202 objects using disk
Content Delivery Network via Amazon Web Services: S3: tutorial9.s3.amazonaws.com

Served from: www.tutorial9.net @ 2012-02-11 15:32:39 -->
