<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Blog of Shaun McCran - Architecting robust, elegant technical and business solutions - CSS</title>
			<link>http://www.mccran.co.uk/index.cfm</link>
			<description>I write about Architecture and Design, Architectural patterns, Architectural Principles and Architectural policies. This includes TOGAF, Zachman, Business Architecture, SOA and Process and tools such as the IBM Rational software and Adobe products. I also write about my previous life as a mobile and web developer.</description>
			<language>en-gb</language>
			<pubDate>Tue, 09 Jun 2026 06:55:22 -0000</pubDate>
			<lastBuildDate>Tue, 06 Sep 2011 08:23:00 -0000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>shaun@mccran.co.uk</managingEditor>
			<webMaster>shaun@mccran.co.uk</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>shaun@mccran.co.uk</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			
			
			
			
			<item>
				<title>Position:relative and overflow CSS issues in Internet Explorer</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/9/6/Positionrelative-and-overflow-CSS-issues-in-Internet-Explorer</link>
				<description>
				
				I was working on a project this week and in the final testing phases I noticed that there was some unusual behaviour in Internet explorer.

A div with an overflow of auto had elements within it that had a position: relative class. The problem here was that the elements remained fixed in place, and the scrollbar was no longer scrolling their content.
				 [More]
				</description>
				
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<pubDate>Tue, 06 Sep 2011 08:23:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/9/6/Positionrelative-and-overflow-CSS-issues-in-Internet-Explorer</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>IE9 .Woff font browser support test</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/8/3/IE9-Woff-font-browser-support-test</link>
				<description>
				
				I started using Font Squirrel a while ago to embed custom font faces into websites. After upgrading to Windows 7 I encountered a heavily documented issue about IE 9 and @font faces.
				 [More]
				</description>
				
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<pubDate>Wed, 03 Aug 2011 02:50:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/8/3/IE9-Woff-font-browser-support-test</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>CSS 3 rounded corners - Background tip</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/1/6/CSS-3-rounded-corners--Background-tip</link>
				<description>
				
				Recently I noticed a CSS issue with CSS 3 rounded corners. There are a few instances where the order of your CSS is critical to the display layer. This article deals with rounded corners and background colours.
&lt;p&gt;
				 [More]
				</description>
				
				
				<category>CSS</category>
				
				<pubDate>Thu, 06 Jan 2011 14:51:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/1/6/CSS-3-rounded-corners--Background-tip</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Why develop cross browser designs - why not code to specific browser strengths?</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/11/8/Why-develop-cross-browser-designs--why-not-code-to-specific-browser-strengths</link>
				<description>
				
				I&apos;ve been working for a marketing Agency for the best part of a year now, and one of the things that always rear&apos;s its head in a digital project is the compatibility of designs in multiple browsers. 

We have all encountered  differences in design compatibility and functionality due to the browser vendor and version number, but the usual course of action is try and code solutions that address the differences in browsers in an effort to make them look and work in the same way.

This article examines why that is the case, and I put forward the argument that by doing this you are spending valuable project time trying to ensure the same user experience on different browsers, when it may be a much better idea to use that same development time coding to the strengths of each of those browsers, to create a more rich user experience instead of a more generic one.
				 [More]
				</description>
				
				
				<category>Best practices</category>
				
				<category>CSS</category>
				
				<category>Social media</category>
				
				<category>Web technologies</category>
				
				<pubDate>Mon, 08 Nov 2010 13:42:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/11/8/Why-develop-cross-browser-designs--why-not-code-to-specific-browser-strengths</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Jquery Rounded Corners Plugin Example - cross browser CSS replacement</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/9/8/Jquery-Rounded-Corners-Plugin-Example--cross-browser-CSS-replacement</link>
				<description>
				
				A while ago I wrote an article on how to implement CSS3 and Cross browser rounded corner CSS. That article (&lt;a href=&quot;http://www.mccran.co.uk/index.cfm/2010/7/8/CSS-3-Rounded-Corners-Example&quot; target=&quot;_blank&quot;&gt;http://www.mccran.co.uk/index.cfm/2010/7/8/CSS-3-Rounded-Corners-Example&lt;/a&gt;) mentions that the CSS3 code has not been adopted as a standard by some browsers (IE - I&apos;m looking at you) but that there are some work around&apos;s to it, most of which involve re writing DOM elements using JavaScript.
&lt;p&gt;
This article deals with a JQuery plugin that can emulate a totally cross browser CSS3 rounded corners solution.
&lt;p&gt;
There is an example of the finished code here: &lt;a href=&quot;http://www.mccran.co.uk/examples/jquery-rounded-corners/&quot; target=&quot;_blank&quot;&gt;JQuery Rounded Corners example&lt;/a&gt;
&lt;p&gt;
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<pubDate>Wed, 08 Sep 2010 15:50:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/9/8/Jquery-Rounded-Corners-Plugin-Example--cross-browser-CSS-replacement</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>CSS 3 Rounded Corners Example</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/7/8/CSS-3-Rounded-Corners-Example</link>
				<description>
				
				My curiosity into CSS 3 was piqued at Scotch on the Rocks 2010 this year. There was a very good presentation from Chris Mills from Opera &lt;a href= http://twitter.com/chrisdavidmills target=_blank&gt; http://twitter.com/chrisdavidmills&lt;/a&gt; where he touched on some of the new CSS 3 and HTML 5 functionality that some of the modern browsers are taking advantage of. I particularly liked some of the really simple, but visual CSS 3 changes, in this case rounded corners.

This article is a quick example of how to add rounded corner styling to your designs.

&lt;a href=&quot;http://www.mccran.co.uk/examples/css3rounded/&quot; target=&quot;_blank&quot;&gt;Here is a demo of CSS 3 rounded corners in action.&lt;/a&gt;
				 [More]
				</description>
				
				
				<category>CSS</category>
				
				<category>Web technologies</category>
				
				<pubDate>Thu, 08 Jul 2010 12:46:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/7/8/CSS-3-Rounded-Corners-Example</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using the JQuery Cookie plugin to emulate server side forms</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/7/5/Using-the-JQuery-Cookie-plugin-to-emulate-server-side-forms</link>
				<description>
				
				A project request recently came up where we needed to track some users responses to a series of questions, then build an account &apos;home&apos; page based on those responses. Pretty straight forward you&apos;ll agree. The problem here arose from the clients using a bespoke online solution that blocked any kind of server side interaction.

I&apos;ve played with JavaScript cookies in the past to remember display states in JQuery functions, so I thought they would be a great solution to this. This article deals with how to use JavaScript cookies to emulate a normal form submission.

There is a &lt;a href=&quot;http://www.mccran.co.uk/examples/jscookies/&quot;&gt;demo of using the JQuery Cookie plugin to emulate forms here&lt;/a&gt;.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<pubDate>Mon, 05 Jul 2010 12:27:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/7/5/Using-the-JQuery-Cookie-plugin-to-emulate-server-side-forms</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using cfcontent to serve up Coldfusion generated CSS documents</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/5/11/Using-cfcontent-to-serve-up-Coldfusion-generated-CSS-documents</link>
				<description>
				
				The article deals with using cfcontent to serve up dynamic data driven CSS. I&apos;ll use Coldfusion to embed variables in a cfm file, then use cfcontent to have the browser serve the content as a CSS file.
				 [More]
				</description>
				
				
				<category>Coldfusion</category>
				
				<category>CSS</category>
				
				<pubDate>Tue, 11 May 2010 16:48:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/5/11/Using-cfcontent-to-serve-up-Coldfusion-generated-CSS-documents</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using JQuery to alter CSS properties of page elements using a checkbox form field</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/4/20/Using-JQuery-to-alter-CSS-properties-of-page-elements-using-a-checkbox-form-field</link>
				<description>
				
				I was recently writing a form where I needed to control the visibility of a div element based on a user selection. If a user checked the checkbox, then a div was to appear with related options in it. This article deals with using JQuery to alter CSS properties on the fly.
				 [More]
				</description>
				
				
				<category>JQuery</category>
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<category>RIA</category>
				
				<pubDate>Tue, 20 Apr 2010 15:01:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/4/20/Using-JQuery-to-alter-CSS-properties-of-page-elements-using-a-checkbox-form-field</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Creating a pop up floating div with JQuery</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/2/23/Creating-a-pop-up-help-floating-div-with-JQuery</link>
				<description>
				
				This entry will deal with how to create a displayed / collapsible floating div, using JQuery.

When I build a web platform I often like to include small sections of text alongside the functionality, just to provide the users with a little guidance on what is going on.

Rather than having these inline, where they can often interfere with the content and display, I like to add them to a &apos;help&apos; div that I float inside the framework.

First we include the JQuery library from Google, and our link. It doesn&apos;t go anywhere, but we will attach a JQuery event to it.

&lt;code&gt;

&lt;s/cript type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;

&lt;a href=&quot;javascript:void(0);&quot; id=&quot;help&quot;&gt;Pop me up&lt;/a&gt;
&lt;div&gt;stuff&lt;/div&gt;

&lt;/code&gt;

Next we create our JQuery function, attached to the &apos;help&apos; div. This adds a div to the document with whatever content you have set in it. There is also a &apos;close&apos; link in the floating div that calls the close function.

&lt;code&gt;

&lt;s/cript&gt;
    $(function() {
        $(&quot;#help&quot;).live(&apos;click&apos;, function(event) {
            $(this).addClass(&quot;selected&quot;).parent().append(&apos;&lt;div class=&quot;messagepop pop&quot;&gt;Content&lt;p&gt;&lt;a class=&quot;close&quot; href=&quot;/&quot;&gt;Cancel&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&apos;);
            $(&quot;.pop&quot;).slideFadeToggle()
            return false;
        });

        $(&quot;.close&quot;).live(&apos;click&apos;, function() {
            $(&quot;.pop&quot;).slideFadeToggle();
            $(&quot;#contact&quot;).removeClass(&quot;selected&quot;);
            return false;
        });
    });

    $.fn.slideFadeToggle = function(easing, callback) {
        return this.animate({ opacity: &apos;toggle&apos;, height: &apos;toggle&apos; }, &quot;fast&quot;, easing, callback);
    };
&lt;/script&gt;

&lt;/code&gt;

Lastly we add some styling and positioning to tie the whole lot together. This gives the pop up div its shape and style. I&apos;ve positioned the floating div on top of the calling function text.

&lt;code&gt;

&lt;style&gt;
a.selected {
  background-color:#1F75CC;
  color:white;
  z-index:100;
}

.messagepop {
  background-color:#FFFFFF;
  border:1px solid #999999;
  cursor:default;
  display:none;
  margin-top: 15px;
  position:absolute;
  text-align:left;
  width:394px;
  z-index:50;
  padding: 25px 25px 20px;
  top: 0px;
  left: 0px;
}
}

label {
  display: block;
  margin-bottom: 3px;
  padding-left: 15px;
  text-indent: -15px;
}

.messagepop p, .messagepop.div {
  border-bottom: 1px solid #EFEFEF;
  margin: 8px 0;
  padding-bottom: 8px;
}
&lt;/style&gt;

&lt;/code&gt;

You can see an example functionality &lt;a href=&quot;http://www.mccran.co.uk/examples/popdiv&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.
&lt;p&gt;
				
				</description>
				
				
				<category>JQuery</category>
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<category>RIA</category>
				
				<pubDate>Tue, 23 Feb 2010 09:52:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/2/23/Creating-a-pop-up-help-floating-div-with-JQuery</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>NoScript alternatives for Javascript content using CSS visibilty</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/2/4/NoScript-alternatives-for-Javascript-content-using-CSS-visibilty</link>
				<description>
				
				I recently stumbled upon an interesting dilemma whilst using an image map that was dynamically generated from a Coldfusion Query. If you turn JavaScript off, then the image maps primary graphic still stays visible (and occupies the same space on a page), but none of the map links function anymore.
 
The problem was to replace the map content with a list of hyperlinks that provide the same functionality. Initially I set the maps div CSS to be hidden. In this way the map is not shown by default. 

&lt;code&gt;
// css
.interactiveMap {visibility: hidden;}
&lt;/code&gt;

Next we can use a JavaScript call to change the CSS visibility to &apos;visible&apos;. In this way if JavaScript is disabled the graphic remains hidden, if JavaScript is enabled it turns in on.

&lt;code&gt;
&lt;s/cript&gt;
	// show the map
	document.getElementById(&apos;interactiveMap&apos;).style.visibility = &quot;visible&quot;;
&lt;/s/cript&gt;
&lt;/code&gt;

Lastly we can create the content that we want to see instead of the map. Don&apos;t forget to wrap it all in the no script html tag.

&lt;code&gt;
&lt;noscript&gt;Your browser does not support JavaScript!
&lt;p&gt;&lt;/p&gt;

&lt;!--- get the regions list ---&gt;
&lt;cfset variables.regions = getRegions()&gt;

&lt;ul&gt;
&lt;cfloop query=&quot;variables.regions&quot;&gt;
&lt;li&gt;&lt;a href=&quot;region.cfm?region=#variables.regions. regionid#&quot;&gt;#variables.regionName#&lt;/a&gt;&lt;/li&gt;
&lt;/cfloop&gt;

&lt;/ul&gt;
&lt;/noscript&gt;
&lt;/code&gt;

By altering the css properties like this we can have the map and the no script content occupy the same real estate on the screen. If you simply populate the no script with the alternative, then the space the map occupies stays occupied, just by a hidden map, giving you a large blank space.
				
				</description>
				
				
				<category>Accessibility</category>
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<pubDate>Thu, 04 Feb 2010 17:25:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/2/4/NoScript-alternatives-for-Javascript-content-using-CSS-visibilty</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Creating a CSS only cross browser drop down menu</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/1/8/Creating-a-CSS-only-cross-browser-drop-down-menu</link>
				<description>
				
				I&apos;ll say this up front, I&apos;m not a CSS guru. I like CSS, but it can be incredibly frustrating. One of the clients I am currently producing work for requires a high level of Accessibility. High enough that we need to avoid using JavaScript unless any script has a &quot;Non&quot; JavaScript equivalent.

The site navigation is through a top level horizontal menu, but what if we also want a drop down menu? Can we do it in CSS only, and it still be Firefox, Internet Explorer 6,7 and 8 compatible? 

Yes, we can, but it&apos;s a lot of code, and it&apos;s not pretty. The basic concept behind most CSS menus is to use a list, and transform each list item to suit your styling. So we will create a div, with a class of menu. Then create a list inside it.

&lt;code&gt;
	&lt;div class=&quot;menu&quot;&gt;
		&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;&quot;&gt;Top menu option
		&lt;!--[if IE 7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;
		&lt;!--[if lte IE 6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;
	
		&lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 1&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 2&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 3&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 4&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 5&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;&quot;&gt;Link 6&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;

			&lt;!--[if lte IE 6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/a&gt;&lt;![endif]--&gt;
		&lt;/li&gt;
		
		&lt;/ul&gt;
	
	&lt;/div&gt;
&lt;/code&gt;

Notice that there are some specific if statements relating to different versions of Internet Explorer. these basically make the functionality the same for each version, they are compensating for the differences in code handling between IE versions.

Next create a set of CSS styles to alter the appearance of the list. I am not going to go into the CSS line by line, as it is commented, but I&apos;ll explain the methodology behind it.

The top level menu item is always displayed, but the list is hidden using &quot;visibility:hidden&quot;. When the user mouse&apos;s over the menu div the CSS applies a:hover ul{visibility:visible;. This makes the list visible. 

&lt;code&gt;

&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;

.menu {width:149px; height:32px; position:relative; z-index:100;border-right:1px solid #000; font-family:arial, sans-serif;}

/* hack to correct IE5.5 faulty box model */
* html .menu {width:149px; w\idth:149px;}

/* remove all the bullets, borders and padding from the default list styling */
.menu ul {padding:0;margin:0;list-style-type:none;}
.menu ul ul {width:149px;}

/* float the list to make it horizontal and a relative position so that you can control the dropdown menu positon */
.menu li {float:left;width:149px;position:relative;}

/* style the links for the top level */
.menu a, .menu a:visited {display:block;font-size:12px;text-decoration:none; color:#fff; width:138px; height:30px; border:1px solid #000; border-width:1px 0 1px 1px; background:#c0c0c0; padding-left:10px; line-height:29px; font-weight:bold;}

/* a hack so that IE5.5 faulty box model is corrected */
* html .menu a, * html .menu a:visited {width:149px; w\idth:138px;}

/* style the second level background */
.menu ul ul a.drop, .menu ul ul a.drop:visited {background:#c0c0cc url(arrow.gif) no-repeat 130px center;}

/* style the second level hover */
.menu ul ul a.drop:hover{background:#c0c0cc url(arrow.gif) no-repeat 130px center;}
.menu ul ul :hover &gt; a.drop {background:#c0c0cc url(arrow.gif) no-repeat 130px center;}

/* hide the sub levels and give them a positon absolute so that they take up no room */
.menu ul ul {visibility:hidden;position:absolute;height:0;top:31px;left:0; width:149px;border-top:1px solid #000;}

/* another hack for IE5.5 */
* html .menu ul ul {top:30px;t\op:31px;}

/* style the table so that it takes no part in the layout - required for IE to work */
.menu table {position:absolute; top:0; left:0; border-collapse:collapse;}

/* style the second level links */
.menu ul ul a, .menu ul ul a:visited {background: ghostwhite; color:#000; height:auto; line-height:1em; padding:5px 10px; width:128px;border-width:0 1px 1px 1px;}

/* yet another hack for IE5.5 */
* html .menu ul ul a, * html .menu ul ul a:visited {width:150px;w\idth:128px;}

/* style the top level hover */
.menu a:hover, .menu ul ul a:hover{color:#000; background:#c0c0cc;}
.menu :hover &gt; a, .menu ul ul :hover &gt; a {color:#000; background:#c0c0cc;}

/* make the second level visible when hover on first level list OR link */
.menu ul li:hover ul,
.menu ul a:hover ul{visibility:visible;}
&lt;/code&gt;

There are also a lot of other browser specific hacks present, as the aim was to get the menu working in every Internet Explorer version, and be Accessible.

There is a demo of this here: &lt;a href=&quot;http://www.mccran.co.uk/css/demo.cfm&quot; target=&quot;_blank&quot;&gt;CSS menu demo&lt;/a&gt;
				
				</description>
				
				
				<category>Internet Explorer</category>
				
				<category>Accessibility</category>
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 08 Jan 2010 16:47:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/1/8/Creating-a-CSS-only-cross-browser-drop-down-menu</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>My handy IE CSS tweaks list</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/12/18/My-handy-IE-CSS-tweaks-list</link>
				<description>
				
				I&apos;m not really a design kind of person, I like designing things, and I&apos;m learning more and more CSS all the time, but it&apos;s the server side coding that I love like Apple Pie and custard.

Recently I&apos;ve had to do a bit more design work, so I&apos;ve been tripping all over myself to get CSS working in IE6,IE7,IE8 and firefox. I&apos;ve learnt a few interesting things in the last few days, and I know I&apos;m going to need to use them again. Some are considered &apos;hacks&apos;, some are just clever CSS techniques. They all feel a bit like secret rules of a club I&apos;m not really a member of yet though.

So I&apos;m making a handy list, so I don&apos;t loose them. I hope to refine and add to this on an ongoing basis, so if you know a better / easier way please let me know. After all coding standards are for life, not just Christmas, and I don&apos;t like the idea of anything being a hack, even if it is CSS.

&lt;h3&gt;Adding a 1px high line to IE&lt;/h3&gt;
I am trying to add a 1px line, like a HR line to the page, it displays fat in IE?

It seems that some versions of IE will display a div without content as the same height as your font size. Add html comments to it to drop it down to the right height:
&lt;code&gt;
&lt;style&gt;
.yellow-ruler {color: #ffd520; background-color:#ffd520; width: 100%; height:2px; margin: 3px 0px 0px 0px;}
&lt;/style&gt;
&lt;div class=&quot;yellow-ruler&quot;&gt;&lt;!-- --&gt;&lt;/div&gt;
&lt;/code&gt;

&lt;h3&gt;IE is adding padding and margins to everything by default&lt;/h3&gt;

I think there is a lot more information about this out there, but for now I&apos;ve found that adding the code below will kill most of IE&apos;s random padding/margin issues.

&lt;code&gt;
* {margin:0; padding:0; border: 0px;}
&lt;/code&gt;

&lt;h3&gt;I&apos;ve built a JQuery accordion and the content doesn&apos;t move correctly&lt;/h3&gt;

When expanding a JQuery accordion element the content underneath it is not moving down, and the accordion is expanding over it. This was a simple fix, but a bit of a pain to find. Just do not specify a height attribute on the div that hold the accordion, IE will stick to the height, but firefox will let it grow to be longer.

&lt;h3&gt;Styling form element borders&lt;/h3&gt;

If you have a CSS rule like the one above that removes all the margins, padding and borders then all your form elements will have no border. IE your text fields and textareas etc will not have a clearly defined edge to them. By adding the line of CSS under this (select,input, etc) you can set the style width and colour of your form elements so that you control them, rather than the browser defaults. In Internet explorer this will also add borders to the checkbox and radio form elements. There does not seem to be any way of writing a CSS style to remove this inherently, so create a style of borderless and set all your radio and checkbox fields to &quot;class=borderless&quot;.

&lt;code&gt;
* {margin:0; padding:0; border: 0px;}

select,input,textarea{border-width: 1px; border-style: solid; border-color: grey;}

/* IE stops the radio borders */
.borderless{border: 0px;}
&lt;/code&gt;

&lt;h3&gt;Strange IE positioning fix&lt;/h3&gt;

Sometimes in IE (mainly 6) using position: absolute just does not render the div on screen. I am not sure why. Adding a &quot;clear: both;&quot; or a &quot;clear: left;&quot; or a &quot;clear: right;&quot; appears to fix this.

&lt;h3&gt;Easy centering of elements&lt;/h3&gt;

I used to struggle with centering elements on a page all the time, but now you can do something like this:

&lt;code&gt;
P.blockoftext {
    margin-left: auto;
    margin-right: auto;
    width: 6em
}

&lt;p class=&quot;blocktext&quot;&gt;Text&lt;/p&gt;

&lt;/code&gt;

This will center a block of text and give it a width of 6.

For images you can do this:

&lt;code&gt;

img.displayed {
    display: block;
    margin-left: auto;
    margin-right: auto }

&lt;img class=&quot;displayed&quot; src=&quot;...&quot; alt=&quot;...&quot;&gt;

&lt;/code&gt;

That will auto center the image inside its containing div.
				
				</description>
				
				
				<category>Internet Explorer</category>
				
				<category>CSS</category>
				
				<category>Browsers</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 18 Dec 2009 12:05:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/12/18/My-handy-IE-CSS-tweaks-list</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Altering bullet point styling using css</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/11/13/Altering-bullet-point-styling-using-css</link>
				<description>
				
				I&apos;ve been writing an error handler that uses JQuery to output a list of errors on a validation event. The error display uses a html list display, and the default display style is a bullet list. This is a simple css script to change the bullet style to something else. In this case nothing!

&lt;code&gt;
&lt;style&gt;
      ul.list-cleaned {
        margin: 0;
        padding: 0;
      }
      ul.list-cleaned li {
        margin: 0;
        padding: 2px 0 2px 16px;
        list-style: none;}
&lt;/style&gt;

&lt;ul class=&quot;list-cleaned&quot;&gt;
	&lt;li&gt;First list item&lt;/li&gt;
	&lt;li&gt;Second list item&lt;/li&gt;
	&lt;li&gt;Third list item&lt;/li&gt;
&lt;/ul&gt;
&lt;/code&gt;

&lt;b&gt;Output:&lt;/b&gt;
&lt;style&gt;
      ul.list-cleaned {
        margin: 0;
        padding: 0;
      }
      ul.list-cleaned li {
        margin: 0;
        padding: 2px 0 2px 16px;
        list-style: none;}
&lt;/style&gt;

&lt;ul class=&quot;list-cleaned&quot;&gt;
	&lt;li&gt;First list item&lt;/li&gt;
	&lt;li&gt;Second list item&lt;/li&gt;
	&lt;li&gt;Third list item&lt;/li&gt;
&lt;/ul&gt;

I think it looks a bit cleaner than bullet points.
				
				</description>
				
				
				<category>CSS</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 13 Nov 2009 08:53:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/11/13/Altering-bullet-point-styling-using-css</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Dynamically colouring swfs using Flashvars to match generic templates</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/10/2/Dynamically-colouring-swfs-using-Flashvars-to-match-generic-templates</link>
				<description>
				
				One of the application frameworks that I regularly work in is an entirely generic, white box solution. It builds itself based on some instantiation variables. This includes the CSS for that instance of the application. More recently I was integrating a swf object that would be used on hundreds of instances of this application, but it was generically coloured, which just wouldn&apos;t work. I needed to somehow have the flash object fit the CSS style of that instance of the App.

&lt;b&gt;Solution&lt;/b&gt;

The flash object accepts a series of Flashvars that are passed into it on load. Like this:

&lt;code&gt;
var flashvars = {};
	flashvars.path = &quot;value&quot;;
	flashvars.upload_url = &quot;value&quot;;
	flashvars.color = &quot;value&quot;;
	flashvars._border_color = &quot;value&quot;;
&lt;/code&gt;

So all I had to do was find a common element in the framework, pick its colour CSS property out, and inject it into the Flashvars object. Using the prototype method of &apos;&lt;a href=http://www.prototypejs.org/api/element/getStyle target=&quot;new&quot;&gt;getStyle&lt;/a&gt;&apos; we can pass in the id of an element, and retrieve its CSS property, IE the background-color.

&lt;code&gt;
var swfBg = $(&apos;element id&apos;).getStyle(&apos;background-color&apos;);
swfBg = swfBg.parseColor().replace(&apos;#&apos;,&apos;&apos;);
alert(swfBg);
&lt;/code&gt;

This returns an RGB value, so we run it through the &apos;parseColor&apos; method, and strip the hash. This gives us a valid Hex colour value, which we use in the Flashvars instead of a hard coded colour code.

&lt;code&gt;
var flashvars = {};
	flashvars.path = &quot;value&quot;;
	flashvars.upload_url = &quot;value&quot;;
	flashvars.color = swfBg;
	flashvars._border_color = &quot;value&quot;;
&lt;/code&gt;
				
				</description>
				
				
				<category>CSS</category>
				
				<category>Javascript</category>
				
				<category>RIA</category>
				
				<category>AJAX</category>
				
				<pubDate>Fri, 02 Oct 2009 12:38:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/10/2/Dynamically-colouring-swfs-using-Flashvars-to-match-generic-templates</guid>
				
				
			</item>
			
		 	
			</channel></rss>