<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Trond Ulseth&apos;s Blog - CSS</title>
			<link>http://trond.ulseth.no/index.cfm</link>
			<description>Trond Ulseth</description>
			<language>en-us</language>
			<pubDate>Wed, 02 Jan 2008 12:57:50 -0600</pubDate>
			<lastBuildDate>Mon, 26 Nov 2007 09:22:00 -0600</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>trond@ulseth.no</managingEditor>
			<webMaster>trond@ulseth.no</webMaster>
			
			
			
			
			
			<item>
				<title>Alternate row colors with jQuery</title>
				<link>http://trond.ulseth.no/index.cfm/2007/11/26/Alternate-row-colors-with-JQuery</link>
				<description>
				
				I was in the need of a script for alternating row colors in a table on a web site I&apos;m doing. I&apos;ve done this before, but since I&apos;m getting into jQuery these days I thought I&apos;d try to find a way of doing it using this.

Well, a little Googling and I came upon &lt;a href=&quot;http://www.packtpub.com/article/jquery-table-manipulation-part2&quot; target=&quot;_blank&quot;&gt;this website&lt;/a&gt;.

This is an excerpt from the book Learning jQuery. Need to try and get my boss to buy that one.
				
				</description>
				
				<category>jQuery</category>
				
				<category>DHTML / Javascript</category>
				
				<category>CSS</category>
				
				<pubDate>Mon, 26 Nov 2007 09:22:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/11/26/Alternate-row-colors-with-JQuery</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>The IE6 Peekaboo bug - solution</title>
				<link>http://trond.ulseth.no/index.cfm/2007/11/19/The-IE6-Peekaboo-bug--solution</link>
				<description>
				
				I was doing the closing check on a clients web site before posting it live, and so I was testing to see that the site looks and works ok in all major browsers. This of course includes the dreaded monstrosity of a web browser IE6.

For some unclear reason some parts of the content did not show. It was just gone.

After some googling around I found that this is a pretty well known phenomena, and is named the Peekaboo bug.

Now if you google &quot;Peekaboo bug&quot; you&apos;ll find plenty of help. The first solution that I stumbled across that helped me was to add a line-height attribute to the element surrounding all the content that was disappearing.

To give propper credit, I found the solution &lt;a href=&quot;http://www.webmasterworld.com/forum83/2090.htm&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.
				
				</description>
				
				<category>CSS</category>
				
				<pubDate>Mon, 19 Nov 2007 06:29:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/11/19/The-IE6-Peekaboo-bug--solution</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Dealing with IE6 and png&apos;s - part 3</title>
				<link>http://trond.ulseth.no/index.cfm/2007/10/18/Dealing-with-IE6-and-pngs--part-3</link>
				<description>
				
				This entry will look at a couple of problems that might arise when using the methods outlined in part 1.

Let&apos;s look at what we did. We had this part of css...

&lt;code&gt;
#banner {
height: 114px;
background-image: url(/images/header_bg.png)
}
&lt;/code&gt;

...where the transparent background png would not work in IE6.

What we did was change it to this:

&lt;code&gt;
#banner {
height: 114px;
background-image: url(/images/header_bg.png)
}

/* IE hack */
* html #banner {
background-image: none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=&apos;/images/header_bg.png&apos;);
}
&lt;/code&gt;

Here we use a IE hack to set background to none, and uses the IE only AlphaImageLoader filter to provide the png background.

So far, so good.

&lt;h2&gt;Problem 1&lt;/h2&gt;

The #banner element has a set height in our example here. But if you try this on an element which have no set heigth, the background will not show. What usually makes the trick here is to add height: 100%; to the fix like so:

&lt;code&gt;
/* IE hack */
* html #banner {
background-image: none;
height: 100%;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=&apos;/images/header_bg.png&apos;);
}
&lt;/code&gt;

&lt;h2&gt;Problem 2&lt;/h2&gt;

When using this fix you will often experience that url&apos;s  will not be clickable, and form elements and text is not selectable.

What I have found to work is to first create a inner element. So if your html code was so:

&lt;code&gt;
&lt;div id=&quot;banner&quot;&gt;
Some text and/or images here.
&lt;/div&gt;
&lt;/code&gt;

This needs to be changed to:

&lt;code&gt;
&lt;div id=&quot;banner&quot;&gt;
&lt;div id=&quot;innerbanner&quot;&gt;
Some text and/or images here.
&lt;/div&gt;
&lt;/div&gt;
&lt;/code&gt;

Then change your css to something like this:

&lt;code&gt;
/* IE hack */
* html #banner {
background-image: none;
height: 100%;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=&apos;/images/header_bg.png&apos;);
}

* html #innerbanner {
position: relative;
height: 100%;
width: 100%;
z-index: 10;
}
&lt;/code&gt;

The most important thin here as I understand is the relative positioning of the innerbanner element, but the other attributes might help as well, so I always leave them in there.

&lt;h2&gt;Problem 3&lt;/h2&gt;

The code css code above is ugly, messy and it will not validate. I suggest you make a separate css file called something like ie6_or_less.css and put the IE hack css into it.

Then in your html template call it like this:

&lt;code&gt;
&lt;!--[if lte IE 6]&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/ie6_or_less.css&quot; /&gt;
&lt;![endif]--&gt;
&lt;/code&gt;

This conditional statement within html comments makes sure that only IE browsers version 6 or less will load and use the ugly code.

That wrapps it up for this round.
				
				</description>
				
				<category>CSS</category>
				
				<pubDate>Thu, 18 Oct 2007 08:37:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/10/18/Dealing-with-IE6-and-pngs--part-3</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CSS Hacks overview</title>
				<link>http://trond.ulseth.no/index.cfm/2007/5/14/CSS-Hacks-overview</link>
				<description>
				
				If you, like me, now and then find your self in need of fixing issues of a websites appearance in one browser or the other, you might find &lt;a href=&quot;http://www.webdevout.net/css-hacks&quot; target=&quot;_blank&quot;&gt;this overview&lt;/a&gt; over different CSS Hacks usefull.
				
				</description>
				
				<category>CSS</category>
				
				<pubDate>Mon, 14 May 2007 09:09:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/5/14/CSS-Hacks-overview</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Dealing with IE6 and png&apos;s - part 2</title>
				<link>http://trond.ulseth.no/index.cfm/2007/3/23/Dealing-with-IE6-and-pngs--part-2</link>
				<description>
				
				Ok - here&apos;s the long awaited follow up to this little series of posts dealing with IE6 and png&apos;s.

The last time we saw how we can make use of transparent png&apos;s as backgrounds in our site layouts, included in our .css files. But what if we want to use png in our html source like so:

&lt;code&gt;
&lt;img src=&quot;/images/transparentIllustration.png&quot; heigth=&quot;20&quot; width=&quot;200&quot; /&gt;
&lt;/code&gt;

Here&apos;s the way I prefer to deal with such situations. This method is a &quot;implement once, work on all images&quot; kinda thing.

The downside, but one I&apos;m willing to live with, is that the IE user has to have JavaScript enabled.

First create a pngfix.js file and paste the following into it:

&lt;code&gt;
var arVersion = navigator.appVersion.split(&quot;MSIE&quot;)
var version = parseFloat(arVersion[1])

if ((version &gt;= 5.5) &amp;&amp; (document.body.filters)) 
{
   for(var i=0; i&lt;document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == &quot;PNG&quot;)
      {
         var imgID = (img.id) ? &quot;id=&apos;&quot; + img.id + &quot;&apos; &quot; : &quot;&quot;
         var imgClass = (img.className) ? &quot;class=&apos;&quot; + img.className + &quot;&apos; &quot; : &quot;&quot;
         var imgTitle = (img.title) ? &quot;title=&apos;&quot; + img.title + &quot;&apos; &quot; : &quot;title=&apos;&quot; + img.alt + &quot;&apos; &quot;
         var imgStyle = &quot;display:inline-block;&quot; + img.style.cssText 
         if (img.align == &quot;left&quot;) imgStyle = &quot;float:left;&quot; + imgStyle
         if (img.align == &quot;right&quot;) imgStyle = &quot;float:right;&quot; + imgStyle
         if (img.parentElement.href) imgStyle = &quot;cursor:hand;&quot; + imgStyle
         var strNewHTML = &quot;&lt;span &quot; + imgID + imgClass + imgTitle
         + &quot; style=\&quot;&quot; + &quot;width:&quot; + img.width + &quot;px; height:&quot; + img.height + &quot;px;&quot; + imgStyle + &quot;;&quot;
         + &quot;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader&quot;
         + &quot;(src=\&apos;&quot; + img.src + &quot;\&apos;, sizingMethod=&apos;scale&apos;);\&quot;&gt;&lt;/span&gt;&quot; 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}
&lt;/code&gt;

Then in the head of your page you do this:

&lt;code&gt;
&lt;!--[if lt IE 7]&gt;
	&lt;script defer type=&quot;text/javascript&quot; src=&quot;/js/pngfix.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;
&lt;/code&gt;

As much as I wish I was smart enough to come up with this my self, the credit goes to &lt;a href=&quot;http://homepage.ntlworld.com/bobosola/index.htm&quot; target=&quot;_blank&quot;&gt;Bob Osola&lt;/a&gt; who in turn is crediting more people on his site.
				
				</description>
				
				<category>DHTML / Javascript</category>
				
				<category>CSS</category>
				
				<pubDate>Fri, 23 Mar 2007 09:48:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/3/23/Dealing-with-IE6-and-pngs--part-2</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Dealing with IE6 and png&apos;s - part 1</title>
				<link>http://trond.ulseth.no/index.cfm/2007/3/13/Dealing-with-IE6-and-pngs--part-1</link>
				<description>
				
				This is the first of two short entries on dealing with png&apos;s in IE6.

Personally I like to use png&apos;s in my site designs, often to create a glow effect on a element laying on top of a gradient and/or patterned background, you can see it here on my blog as well. Here&apos;s the css code for the top part of the blog:

&lt;code&gt;
#banner {
  height: 114px;
  background-image: url(/images/header_bg.png)
}
&lt;/code&gt;

Now let&apos;s see how this looks in IE 6:

&lt;img src=&quot;/images/ie_png1.jpg&quot; alt=&quot;png in IE&quot; /&gt;

Not very pretty. To fix this I added the following css:

&lt;code&gt;
/* IE hack */
* html #banner {
  background-image: none;
  filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=&apos;/images/header_bg.png&apos;);
}
&lt;/code&gt;

Adding * html before the #banner id selector is a hack that makes only IE read this piece of css, and here we use a IE  specific filter to put the background png in, and doing this the png will maintain it&apos;s transparency.
				
				</description>
				
				<category>CSS</category>
				
				<pubDate>Tue, 13 Mar 2007 05:03:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/3/13/Dealing-with-IE6-and-pngs--part-1</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>FarCry tip: background in TinyMCE</title>
				<link>http://trond.ulseth.no/index.cfm/2006/11/14/FarCry-tip-background-in-TinyMCE</link>
				<description>
				
				In the last FarCry post I linked to another post about configuring TinyMCE in FarCry. However most of the time I find that I use TinyMCE like it works right out of the box. It will use the same stylesheet that is configured for the site itself, so the formating you see in TinyMCE will pretty much be the same as on the site.

The only little problem with this is if you in your css have specified a background color or image for body. For example you have a black background for the site, but the content is black text in a div with a white background.

Now what happens is that TinyMCE will use the black background from the body as a background in the editor window.

The solution is quick and easy. In your css include the follwing code:

&lt;code&gt;
.mceContentBody {
	background-image: none;
	background-color: #FFFFFF;
	}
&lt;/code&gt;

Happy FarCry&apos;ing
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>CSS</category>
				
				<category>FarCry</category>
				
				<pubDate>Tue, 14 Nov 2006 03:46:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2006/11/14/FarCry-tip-background-in-TinyMCE</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>A little CSS trick for tables</title>
				<link>http://trond.ulseth.no/index.cfm/2006/10/25/A-little-CSS-trick-for-tables</link>
				<description>
				
				I needed to include a table in a page today, like so many times before. Here&apos;s the code:

&lt;code&gt;
&lt;table&gt;
  &lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;OrderID&lt;/th&gt;&lt;/tr&gt;
  &lt;cfoutput query=&quot;registeredOrders&quot;&gt;
  &lt;tr&gt;&lt;td&gt;#DateFormat(orderDate, &quot;d.mmm yyyy&quot;)#&lt;/td&gt;&lt;td&gt;#objectID#&lt;/td&gt;&lt;/tr&gt;
  &lt;/cfoutput&gt;
&lt;/table&gt;
&lt;/code&gt;

So far so good. Now I wanted to make some borders around the cells. What I&apos;ve previously been doing is to set a cellspacing of 1 pixel on my table, make a background color for the table (the same color as I want for borders, and then another background color for th and td elements. Something like this:

&lt;code&gt;
&lt;style type=&quot;text/css&quot;&gt;
  table {background-color: #000000;}
  th {background-color: #CAE4FF;}
  td {background-color: #FFFFFF;}
&lt;/style&gt;

&lt;table cellspacing=&quot;1&quot;&gt;
  &lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;OrderID&lt;/th&gt;&lt;/tr&gt;
  &lt;cfoutput query=&quot;registeredOrders&quot;&gt;
  &lt;tr&gt;&lt;td&gt;#DateFormat(orderDate, &quot;d.mmm yyyy&quot;)#&lt;/td&gt;&lt;td&gt;#objectID#&lt;/td&gt;&lt;/tr&gt;
  &lt;/cfoutput&gt;
&lt;/table&gt;
&lt;/code&gt;

Now that works. There&apos;s no invalid code. It&apos;s easy to read and manipulate. However, it felt wrong to use a table background color to make a border color. I thought there had to be a better/cleaner way of doing this with CSS only. And so together with my colleague we started looking (using The Google*) and he found a simple css attribute neither of us have used before (and we use a lot of css).

Better to show than to tell. Here&apos;s the code how it looks now:

&lt;code&gt;
&lt;style type=&quot;text/css&quot;&gt;
  table {border-collapse: collapse;}
  th {background-color: #CAE4FF;}
  th, td {border: solid 1px #000000;}
&lt;/style&gt;

&lt;table&gt;
  &lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;OrderID&lt;/th&gt;&lt;/tr&gt;
  &lt;cfoutput query=&quot;registeredOrders&quot;&gt;
  &lt;tr&gt;&lt;td&gt;#DateFormat(orderDate, &quot;d.mmm yyyy&quot;)#&lt;/td&gt;&lt;td&gt;#objectID#&lt;/td&gt;&lt;/tr&gt;
  &lt;/cfoutput&gt;
&lt;/table&gt;
&lt;/code&gt;

So we did not save much code right away. But now all aspects of the formating is controlled by the css. And when dealing with many tables using the same css we will have saved code, and eased the managability.

* &lt;a href=&quot;http://thinkprogress.org/2006/10/23/bush-says-he-uses-the-google/&quot; target=&quot;_blank&quot;&gt;In President Bush&apos;s words&lt;/a&gt;
				
				</description>
				
				<category>CSS</category>
				
				<pubDate>Wed, 25 Oct 2006 10:05:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2006/10/25/A-little-CSS-trick-for-tables</guid>
				
			</item>
			
		 	
			</channel></rss>
<SCRIPT language="Javascript">
<!--

// FILE ARCHIVED ON 20080102185802 AND RETRIEVED FROM THE
// INTERNET ARCHIVE ON 20100801044911.
// JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
// ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
// SECTION 108(a)(3)).

   var sWayBackCGI = "http://web.archive.org/web/20080102185802/";

   function xResolveUrl(url) {
      var image = new Image();
      image.src = url;
      return image.src;
   }
   function xLateUrl(aCollection, sProp) {
      var i = 0;
      for(i = 0; i < aCollection.length; i++) {
         var url = aCollection[i][sProp];         if (typeof(url) == "string") { 
          if (url.indexOf("mailto:") == -1 &&
             url.indexOf("javascript:") == -1
             && url.length > 0) {
            if(url.indexOf("http") != 0) {
                url = xResolveUrl(url);
            }
            url = url.replace('.wstub.archive.org','');
            aCollection[i][sProp] = sWayBackCGI + url;
         }
         }
      }
   }

   xLateUrl(document.getElementsByTagName("IMG"),"src");
   xLateUrl(document.getElementsByTagName("A"),"href");
   xLateUrl(document.getElementsByTagName("AREA"),"href");
   xLateUrl(document.getElementsByTagName("OBJECT"),"codebase");
   xLateUrl(document.getElementsByTagName("OBJECT"),"data");
   xLateUrl(document.getElementsByTagName("APPLET"),"codebase");
   xLateUrl(document.getElementsByTagName("APPLET"),"archive");
   xLateUrl(document.getElementsByTagName("EMBED"),"src");
   xLateUrl(document.getElementsByTagName("BODY"),"background");
   xLateUrl(document.getElementsByTagName("TD"),"background");
   xLateUrl(document.getElementsByTagName("INPUT"),"src");
   var forms = document.getElementsByTagName("FORM");
   if (forms) {
       var j = 0;
       for (j = 0; j < forms.length; j++) {
              f = forms[j];
              if (typeof(f.action)  == "string") {
                 if(typeof(f.method)  == "string") {
                     if(typeof(f.method) != "post") {
                        f.action = sWayBackCGI + f.action;
                     }
                  }
              }
        }
    }


//-->
</SCRIPT>

