Hi I am trying to use two separate style sheets for IE8 and other browsers altogether which consists of changes related to IE8.This is making my task cumbersome and unmanageable.

<!--[If IE 8]>
<link type="text/css" href="IEHacks.css" /><![endif]-->


<!--[if !IE]>
<link type="text/css" href="NonIEHacks.css" />
<!--<![endif]-->

So instead of that I tried for this which requires change in fewer places.

 <table #if ($!MSIEVersion >= 8) border="1" #else border="0"#end class="grid droppable" cellpadding="0" cellspacing="1" width="100%">

Which one according to you is better?

Also I have second question.

<table   class="grid droppable" cellpadding="0" cellspacing="1" width="100%" style="border:1px">

it is not working but if I give

<table   class="grid droppable" cellpadding="0" cellspacing="1" width="100%" border="1">

it is working why?

  • Internet Explorer 8, in standard mode, is the only stable browser that has a complete CSS 2.1 support, so you only need hacks for previous versions. Tae almost 7 years ago

1 answer

o.k.w 2355
1
point

I am surprised you need to have hacks for IE8, as most hacks are implemented for IE7/6. Did you use a doctype declaration that popped IE8 into quirk mode?

For your second question, table border using border attribute and style meant different thing. The former gives border to table and all its cells, while the latter is for the table only. The correct usage of border style should be e.g. 'border: solid 1px #000;'

Update:
Try this code in IE8 and other browsers, they should be the same.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Table border</title> 
<style type="text/css">
table{
    border: solid 1px red;
    border-collapse: collapse;
}
td {
    border: solid 1px red;
    padding: 4px;
}
</style>
</head>
<body>
<table>
  <tr>
    <td>r1c1</td><td>r1c2</td><td>r1c3</td>
  </tr>
  <tr>
    <td>r2c1</td><td>r2c2</td><td>r2c3</td>
  </tr>
</table>
</body>
<html>
Answered almost 7 years ago by o.k.w
  • Great..Thanks for the update..but do you have any clue about my first question...I mean my DOCTYPE for IE is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which is making any difference :-( IE8Sufferer almost 7 years ago
  • This will trigger the IE8 into 'Almost Standard' mode which should not cause the border issue. Unless the compatibilty mode is changed explicitly at the browser. Have you tried 'strict' doctype? o.k.w almost 7 years ago
  • Yes I had tried but no use..any other measures IE8Sufferer almost 7 years ago
  • Care to share your site url? Or upload a page for us to 'examine'. o.k.w almost 7 years ago
  • umm..This is localhost application running in Tomcat,..lots firewall issues..etc..I can send you my static HTML page and CSS files to your e-mail..Thanks IE8Sufferer almost 7 years ago
  • I've added some codes to my answer above, can't you try it to see if it looks alright on your IE8? o.k.w almost 7 years ago