CSS with a ~

One issue of trying to use “~” in your CSS, is the fact that you cannot use [if IE 6] with it.
The problem becomes that the “<!–" becomes a comment.
So below is the .NET fix for this.

<%
string browser = Page.Request.Browser.Browser;
string version = Page.Request.Browser.Version;
version = string.Format(“{0}.{1}”, version.Split(‘.’));
decimal verInt = Convert.ToDecimal(version);
if ((browser == “IE”) && (verInt < 7.0m)) lnkSSIE6.Visible = true;
if ((browser == “IE”) && (verInt >= 7.0m)) lnkSSIE7.Visible = true;
%>

<link id="lnkSSIE6" rel="stylesheet" type="text/css" href="~/css/css_ie6/ct_styles_ie6.css"
runat=”server” visible=”false” />

<link id="lnkSSIE7" rel="stylesheet" type="text/css" href="~/css/css_ie7/ct_styles_ie7.css"
runat=”server” visible=”false” />

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.