I have an html table which is rendered in IE, and Excel (for reporting)
If I set the border-width to thin, it shows a 2px border in IE, and a 1px border in Excel.
However, if I set it to 1px, it shows a 1px border in IE, and a 2px border in Excel(???).
How can I get them to BOTH show a 1px border as it looks horrible with a 2px border.
The minimum width that your screen can display is 1 pixel. So its impossible to display less then 1px. 1 pixels can only have 1 color and cannot be split up.
Adjusting the Margin Size of an HTML Element With CSS You can remove this margin by setting the top and left margin to zero. Like the padding and border, the sizes of specific sides of the margin can be set using margin-left , margin-right , margin-top , and margin-bottom .
Saving a excel file to html genrates CSS like so:
.xl32
{mso-style-parent:style0;
border-top:.5pt solid windowtext;
border-right:1.0pt solid windowtext;
border-bottom:1.0pt solid windowtext;
border-left:.5pt solid windowtext;}
.5 displays as a normal line, 1.0 as a thick line So i guess setting te with to .5pt should work...
I don't know anything about HTML Tables rendered in Excel. I'm curious if it uses IE rendering engine, or some custom rendering engine. (It sounds like it might use a custom one, based on the differences.)
One thing you could try is setting the border to 'thin', and then having a separate CSS rule inside a Conditional IE statement. See QuirksMode.org for more information on IE Conditionals.
So it could be:
<style>
table { border: thin solid black; }
</style>
<!--[if lt IE 9]>
<style>
table { border: 1px solid black; }
</style>
<![endif]-->
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With