Sure,
Im not at my dev machine right now so what I say is "off the top of my head" - not copy-pasted from code.
Basically, As im sure you know, IE6, IE7 seem to mangle your page that renders fine in firefox. Typically developers write CSS for firefox (which is pretty much standards compliant), then add "hacks" for IE. This can be done in the same skin.css file (look up CSS hacks) but I don't like it - I think its hacktastic and I prefer to separate out my fixes from original css.
So what you can do is in javascript in your skin, attach additional stylesheets. For instance, you could attach skin_IE6.css if the browser is IE6. In here you can override just the styles that need overriding - usually its only a couple of margins here a padding there and your page renders fine. For instance, an example of attaching a css file in javascript can be found here: http://www.google.co.uk/search?hl=en&q=javascript+attach+css&btnG=Google+Search&meta=. Javascript can be inserted directly into the skin ascx file, or the container ascx file. The problem is, if your user has JS turned off, they don't get the fix! (Only ~5% of users have no JS. But depending on your site and target audience, this may vary, or may matter more or less)
Alternatively, you can use conditional comments to attach stylesheets: http://virtuelvis.com/archives/2004/02/css-ie-only. The problem with this is you have to add the conditional comment to the head of the page - in default.aspx. This means your fix is not skin-dependent and also it applies to all portals in DNN - not good.
So the idea I had was can you attach the stylesheets using ASP.NET - needing no javascript? Yes you can. If you create a new skin (you must create an ascx file) you get a code-behind file. Inside the code-behind (which can be C# or VB) you get a Page_Load event. This event is called before the page is loaded and before your skin is rendered. Inside Page_Load you can detect browsers and attach skin files as you like. So, assuming your default skin.css renders perfectly in firefox, you could do this:
// Note - this is the bit that's off the top of my head!
Page_Load()
{
string cssFixFile = null;
// Note, "Firefox", "Opera", "Netscape" can all be detected using this method.
if (Request.Browser.Browser.Equals("IE"))
{
// IE detected
//
if (Request.Browser.MajorVersion == 7)
{
// IE7 detected - create a full path to the skin_IE7.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE7.css");
}
else if (Request.Browser.MajorVersion == 6)
{
// IE6 detected - create a full path to the skin_IE6.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE6.css");
}
else if (Request.Browser.MajorVersion == 5 && Request.Browser.MinorVersion == 5)
{
// IE5.5 Detected - create a full path to the skin_IE5_5.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE5_5.css");
}
else if (Request.Browser.MajorVersion <= 5)
{
// IE5 or less detected - create a full path to the skin_IE5.css file
cssFixFile = Path.Combine(this.SkinPath, "skin_IE5.css");
}
// etc... more browser detection possible
}
// Load in the CSS file for the browser
if (cssFixFile != null)
{
// If a CSS file is needed, this part loads it in
HtmlGenericControl link = new HtmlGenericControl("LINK");
link.Attributes.Add("rel","stylesheet");
link.Attributes.Add("type","text/css");
link.Attributes.Add("href", cssFixFile ));
Controls.Add(link);
}
}
Ok I hope all that made sense. Two other things you need to know. In order for this to work in the code-behind, your skin.ascx file must have a code-behind and in the code-behind file your skin must inherit DotNetNuke.UI.Skins.Skin. This is so it can have the SkinPath property which resolves to the directory of the skin.
So your skin declaration will be MySkin : DotNetNuke.UI.Skins.Skin. Also in the Ascx markup file, make sure it points to the code-behind and it inherits MySkin. Just create a new ascx user control in visual web developer and modify the inherited attribute appropriately.
Another thing is this approach also works for containers. If you create a container called MyContainer and in the aspx code-behind file make it inherit DotNetNuke.UI.Containers.Container, then you also get a SkinPath property. This resolves directly to the container directory so you just place container_IE6.css fix files in there.
The result? A clean separation of browser-specific fixes into separate CSS files that doesn't rely on javascript. Your browser specific css files don't need all the styles from skin.css - just the ones you need to override, which hopefully, wont be many!
Good luck!!! :)