Dennie
asked on
toggle table rows IE hides border
Hi Experts,
I made this simple Jquery to toggle table rows with a button:
My HTML looks something like this:
The code works like a charm, except that when the table is collapsed the last row of the table doesn't show a bottom border in Internet Explorer. No problems in Chrome or Firefox...
Any suggestions?
I made this simple Jquery to toggle table rows with a button:
$("a#test-button").click(function(){
$("tr.hidden").toggle();
});
My HTML looks something like this:
<table>
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
</table>
<a id="test-button">Expand/collapse</a>
The code works like a charm, except that when the table is collapsed the last row of the table doesn't show a bottom border in Internet Explorer. No problems in Chrome or Firefox...
Any suggestions?
What happens if you add tbody and what does the CSS look like for the table, rows and cells?
ASKER
No difference with the tbody tag. By the way I just found out it is only an IE7 problem.
Here's the relevant CSS:
[code]
table.reuters-table th {
font-size: 9px;
background:url("../images/ th-table.j pg") repeat-x 0 0;
border: 1px solid #CCCCCC;
color:#4F6B72;
font-weight:bold;
letter-spacing:1px;
padding:3px 3px 3px 12px;
text-align:left;
text-transform:uppercase;
}
table.reuters-table td:first-child {
border-left:1px solid #CCCCCC;
}
table.reuters-table td {
padding:0 3px 0 3px;
background:none repeat scroll 0 0 #FFFFFF;
border-bottom:1px solid #CCCCCC;
border-right:1px solid #CCCCCC;
color:#4F6B72;
}
[/code]
Here's the relevant CSS:
[code]
table.reuters-table th {
font-size: 9px;
background:url("../images/
border: 1px solid #CCCCCC;
color:#4F6B72;
font-weight:bold;
letter-spacing:1px;
padding:3px 3px 3px 12px;
text-align:left;
text-transform:uppercase;
}
table.reuters-table td:first-child {
border-left:1px solid #CCCCCC;
}
table.reuters-table td {
padding:0 3px 0 3px;
background:none repeat scroll 0 0 #FFFFFF;
border-bottom:1px solid #CCCCCC;
border-right:1px solid #CCCCCC;
color:#4F6B72;
}
[/code]
EE has a CODE field
Where is the HIDDEN class?
Where is the HIDDEN class?
ASKER
I have no specific CSS for the hidden class. Only some jquery to hide the hidden rows at document load.
The table.reuters-table td CSS also applies for the hidden class
The table.reuters-table td CSS also applies for the hidden class
$(document).ready(function(){
$("tr.hidden").hide();
});
Thanks.
I do not see anything that should make this happen. I will look for some IE7 specific behaviour such as unhappiness with having borders on the table AND the TD
I do not see anything that should make this happen. I will look for some IE7 specific behaviour such as unhappiness with having borders on the table AND the TD
ASKER
damn I still can't find it. Any ideas?
Sorry - I do not even have IE7 to see it happen
ASKER
IE8 compatibility mode...?
Ah - I forgot my code at home
Do you have a stand-alone version of the issue somewhere?
Do you have a stand-alone version of the issue somewhere?
ASKER
No, the code & CSS in the first posts should be sufficient
Yes, it is, but now I have to put it back together again to test it
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title></title>
<style type="text/css">
table.reuters-table th {
font-size: 9px;
background:url("../images/th-table.jpg") repeat-x 0 0;
border: 1px solid #CCCCCC;
color:#4F6B72;
font-weight:bold;
letter-spacing:1px;
padding:3px 3px 3px 12px;
text-align:left;
text-transform:uppercase;
}
table.reuters-table td:first-child {
border-left:1px solid #CCCCCC;
}
table.reuters-table td {
padding:0 3px 0 3px;
background:none repeat scroll 0 0 #FFFFFF;
border-bottom:1px solid #CCCCCC;
border-right:1px solid #CCCCCC;
color:#4F6B72;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr.hidden").hide();
$("a#test-button").click(function(){
$("tr.hidden").toggle();
});
});
</script>
</head>
<body>
<table class="reuters-table">
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
</table>
<a id="test-button">Expand/collapse</a>
</body>
</html>
Nope. I cannot see the issue in the code I posted
ASKER
PLease try this code
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title></title>
<style type="text/css">
table {border-collapse: collapse;}
table.reuters-table th {
font-size: 9px;
background:url("../images/th-table.jpg") repeat-x 0 0;
border: 1px solid #CCCCCC;
color:#4F6B72;
font-weight:bold;
letter-spacing:1px;
padding:3px 3px 3px 12px;
text-align:left;
text-transform:uppercase;
}
table.reuters-table td:first-child {
border-left:1px solid #CCCCCC;
}
table.reuters-table td {
padding:0 3px 0 3px;
background:none repeat scroll 0 0 #FFFFFF;
border:1px solid #CCCCCC;
color:#4F6B72;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr.hidden").hide();
$("a#test-button").click(function(){
$("tr.hidden").toggle();
});
});
</script>
</head>
<body>
<table class="reuters-table">
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
<tr class="hidden">
<td>data</td>
<td>data</td>
</tr>
</table>
<a id="test-button">Expand/collapse</a>
</body>
</html>
If you remove that
table {border-collapse: collapse;}
it works
table {border-collapse: collapse;}
it works
ASKER
But I need the border-collapse...
Here is a thread that I did not have time to read
http://bytes.com/topic/html-css/answers/154220-seeking-explanation-strange-border-collapse-behavior
http://bytes.com/topic/html-css/answers/154220-seeking-explanation-strange-border-collapse-behavior
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not what I was looking for. But some points for your help. Thanks!