Solved

CSS: why is Mozilla bleeding borders with border-collapse in my code?

Posted on 2004-08-02
6
458 Views
Last Modified: 2010-08-05
Hi, here's some code that works great in IE, but not Mozilla.

border collapse seems to cause the problem but I need border-collapse (although it may not be apparent why in this example... but I do need it in IE. In mozilla I don't need it but I can't figure out a way to set border-collapse only for IE except via DHTML which I don't want to use)

Any ideas?


<STYLE TYPE="text/css">
<!--
TABLE.sheet {border-collapse: collapse}
TD.f0 { border-left: solid 2pt black; border-right: solid 2pt black; border-top: solid 2pt black; border-bottom: solid 2pt black; font-family: "Arial"; font-size: 10pt; background-color: #ffff00; vertical-align: top;}
TD.f1 { font-family: "Arial"; font-size: 10pt; vertical-align: bottom;}
TD.f2 { border-left: solid 2pt #3366ff; border-right: solid 2pt #3366ff; border-top: solid 2pt #3366ff; border-bottom: solid 2pt #3366ff; font-family: "Arial"; font-size: 10pt; font-weight: bold; font-style: italic; background-color: #99ccff; vertical-align: top;}

-->
</STYLE>
<TABLE class=sheet>
  <TR class=sheet height=18 style='height:13.5pt'>
    <TH class=row> 1</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
  <TR class=sheet height=18 style='height:13.5pt'>
    <TH class=row> 2</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD class=f0 ROWSPAN=2 COLSPAN=2> Merged Cells</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=f1 align=right> 1</TD>
  <TR class=sheet height=18 style='height:13.5pt'>
    <TH class=row> 3</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
  <TR class=sheet height=19 style='height:14.25pt'>
    <TH class=row> 4</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
  <TR class=sheet height=18 style='height:13.5pt'>
    <TH class=row> 5</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD class=f2 ROWSPAN=2 COLSPAN=2>Merged Cells</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
  <TR class=sheet height=18 style='height:13.5pt'>
    <TH class=row> 6</TH>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
    <TD width=64 style='width:48pt' class=sheet>&nbsp;</TD>
</TABLE>
0
Comment
Question by:ycomp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 250 total points
ID: 11697179
Sure, set it like this:

TABLE.sheet {_border-collapse: collapse}

This would be IE-only
0
 
LVL 14

Assisted Solution

by:dfu23
dfu23 earned 250 total points
ID: 11697184
<!--[if gte ie 5.5000]>
<style type="text/css">
TABLE.sheet {border-collapse: collapse}
</style>
<![endif]-->
0
 

Author Comment

by:ycomp
ID: 11697318
wow guys thanks.. I wish I'd known about these things the other day. Would have saved me much time.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ycomp
ID: 11697322
Zyloch, what is the logic behind the underscore ?
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 11697345
http://wellstyled.com/css-underscore-hack.html

I wish I was sure you needed to do it this way though :-)

And watch your table code there...
0
 

Author Comment

by:ycomp
ID: 11697481
thanks sean.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Use "if not" in a condition 2 28
Html split(text) Part2 6 41
How to add custom html-5 element to a dynamically generated link? 4 37
Displaying Text in Columns in HTML 3 32
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: blockā€¦
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question