Hi , i am a newbie C# Programmer. I have a problem in xhtml. I want to check that if browser is IE6 or not. For example if ie6 then div id="div1" style="display:block;" else div id="div1" style="display:none;"> How can i control my browser and use if clause in xhtml?
+1
A:
Assign to your div one permanent style:
<div id="div1" class="jumping-div"></div>
Define the default style:
style1.css:
div.jumping-div
{
display:none;
}
Then create another stylesheet which will redefine the class:
style2.css:
div.jumping-div
{
display:block;
}
Then using conditional checks you can include another stylesheet:
<link href="style1.css" rel="Stylesheet" type="text/css" />
<!--[if IE 6]>
<link href="style1.css" rel="Stylesheet" type="text/css" />
<![endif]-->
Developer Art
2010-03-17 20:24:05
i know this but this is not what i am looking for, i have to use "else" statement too?
Mehmet Kaleli
2010-03-17 20:28:10
I'm afraid there is no "else" part. Check the specs: http://msdn.microsoft.com/en-us/library/ms537512%28VS.85%29.aspx
Developer Art
2010-03-17 20:31:46
A:
conditional comments are easiest, you can also do it server side...
<% if (HttpContext.Request.UserAgent.Contains("internet explorer 6")) //Not sure what the exact name is, need to look it up.
{%>
//HTML
<%}%>
Paul Creasey
2010-03-17 20:28:08