How to get borders to collapse in IE10? - border

Has anyone come across a solution for border collapse on tables not working in IE10?
I have tables on web sites used where needed, and they display fine in all other browsers, but Since IE 10 the borders are way to thick.

Above question may be a few months old, but today I've ran into the same problem and thought I could at least provide some possible solution, even though it's not an ideal one.
As the problem describes, using border-collapse causes a thick border in IE10, even though there are no borders that would add up. When leaving out border-collapse, the border-width remains its normal thickness. However, leaving out border-width results in space between cells.
The only possible alternative to get the desired result is to not use border-collapse at all. Instead, use 'border-spacing:0px;' to get rid of the spaces between cells and define borders very specifically.
Example:
This
table{
border-collapse: collapse;
}
table td{
border: 1px solid black;
}
Would become
table{
border-spacing: 0px;
border-top: 1px solid black;
border-right: 1px solid black;
}
table td{
border-left: 1px solid black;
border-bottom: 1px solid black;
}
Like I said before: it's not ideal, but at least it would give the desired cross-browser result.
Note: the problem in IE10 only occurs when using a border-width of 1px. A border-width of 1px will result in 2px when using border-collapse:collapse; in IE10. When using a higher border-width, the result will be normal.

Related

Border assigned over TD is not working in IE

I have a Table in which there are TD's. In one of those td's, I am applying border. It is
working fine in CHROME, but its getting disturbed in IE.
NOTE:- Earlier, when the cellpadding of the table was 2 it was looking fine but when I increased the cellpadding the border got disturbed.
Here is how it looks like
and here is the fiddle
what should I do to make it work in IE
Do you mean you want it looking like this?
https://jsfiddle.net/Hastig/o1j88quk/3/
If so add table { border-collapse: collapse; } to your css.
May also have to remove cellspacing="10" from inline style of table
To remove middle line
change
tr.black-border td {
border-top: 1px solid #0D63B0;
border-bottom: 1px solid #0D63B0;
}
to
tr.black-border:nth-child(3) td {
border-top: 1px solid #0D63B0;
}
tr.black-border:nth-child(4) td {
border-bottom: 1px solid #0D63B0;
}
Alternatively, you can control the border style by adding classes, if old IE has a problem with nth-child(x)

DOMPDF table border issue

I've come across a very strange issue with the latest version of DOMPDF (0.6.0 Beta 3). I'm using it to create invoices for customers on my site. The design calls for 1px borders between the table cells. If I use either black or #000 for the border color, the tables are rendered nicely. However, when I change the color, to say #CCC for example, instead of a 1px border, the borders become 2px. I'm using border-collapse:collapse and I've been pulling my hair out over this for 2 days. I'm not changing anything else except the color, yet the border thickness is changing. Has anyone else run across this issue and know what the solution is or have any suggestions? Why does black render a 1px border but other colors are rendered as 2px borders? Help!
Edit: I also have empty cells filled with as I read that that may cause issues with tables, but still no luck.
This might help. I have not tried to reproduce your problem, but I know it helped with some issues I was having with tables.
try adding this to your css for the table:
table {
border-collapse: collapse;
}
Obviously you can use the appropriate selector in the css and not define the entire table class.
I was having the exact same problem. It's caused from the table having its own border and the cells having their own borders. Here's how I fixed it:
table {
border-left: 0.01em solid #ccc;
border-right: 0;
border-top: 0.01em solid #ccc;
border-bottom: 0;
border-collapse: collapse;
}
table td,
table th {
border-left: 0;
border-right: 0.01em solid #ccc;
border-top: 0;
border-bottom: 0.01em solid #ccc;
}
If anyone facing problem with borders of multiple tables in a row
Replace This
table{ border:collapse; }
with
table{ border-spacing: 0; }
Reference link
I've seen some improvement by setting border thickness to 0.01em
Use border-spacing: -1px;
Instead of border-collapse: collapse;

how to get rid outer table border

I need to get rid outer border, just cells border and there should be space between cells . I can't get why it builds this outer border around the table, I just tried this code in separate file
table {
border-collapse: separate;
border-spacing: 4px;
}
table td, table th {
border: 1px solid black;
}
and it display correctly. But on website content it make this outer border. Can somebody help me?
Just do in your css:
.tribe-events-calendar
{
border: 0px!important;
}
OR
#big
{
border: 0px!important;
}
Or, if it's already there the class or id, modify these values to set them as said. Beware the class, because supposedly it should affect other elements.
Reading again your question, if you set it in a different stylesheet it could happen that it overwrites the values of the 0px with the values of the Npx from the other sheet. Merge them into one, or, if you cannot, put the !important; mark after the css that says 0px.
If nothing works, embed (not include) it at the beginning of your file. Last and least (read: NOT ADVISABLE), use inline css.
I tried to add this: "border: none;" to the table element itself inside the HTML and it worked.
I think your problem is this:
table.tribe-events-calendar, .tribe-events-calendar td {
border: 1px solid #BBB;
}
It overrides your css.
Use chrome's "inspect element" or firebug for Firefox to see the problem.
You Just need to change only one place that is,
Original Code
table.tribe-events-calendar, .tribe-events-calendar td {
border: 1px solid #BBBBBB;
After Modification
table.tribe-events-calendar td {
border: 1px solid #BBBBBB;
You can use Firefox FireBug for inspect and do Live edits for CSS and Jquery.

Add two top borders to a table row with CSS

How can I achieve a similar effect as in http://jsfiddle.net/eLWe3/2/, but without the additional markup?
I tried with tr:before {}, but it messes with the table. Solution has to work with IE8 and up, fallback to a single border on IE7 is okay.
This fork of your original example is as close as I could get. The updated CSS is:
table { margin: 0 auto; border-collapse:separate; }
thead { background: #FDECEE; }
th { font-weight: bold; }
tbody tr:last-child td { border-bottom: 1px solid blue; }
tfoot td { border-top: 1px solid pink; }
But, as you can see, I've not been able to get the 2px gap you wanted between the two borders. As far as I know, this won't be possible without additional markup of some description: hopefully I'm wrong.
​
Edit - I've created a new example that uses generated content to get the gap you're after:
tbody tr:last-child td:after {
content:'';
display:block;
border-bottom: 1px solid blue;
margin-bottom:2px;
}​
It works in Firefox, Chrome and IE9+, falling back to a single border for less capable browsers. The only reason IE8 fails is because it lacks support for last:child to target the final row in the tbody. You could add a class to the last row in the table (either directly or using JavaScript) to get it working in that browser.
not a great idea but use a background image on the relevant row/cell
Maybe this is an acceptable alternative:
tbody {
border-bottom: 2px outset pink;
}

IE 9 and styling the button element

I have a button element where I apply a css class which adds border color to the various sides of the button.
This worked in the previous IE versions, but not in IE 9
HTML:
<button class="hello-button">Hello, World</button>
CSS:
.hello-button {
border-width: 2px;
border-style: solid;
border-color: #eee #a9a9a9 #a9a9a9 #eee;
}
Is this a known issue and are there workarounds besides of the border-style: outset;
I have tried various combinations but it seems like you can not any longer style the borders of the button element.
Edit: formating
If you specify 3 of the borders, those borders will render in IE9. Once you specify the 4th border, IE9 refuses to render any of the borders
Works:
.hello-button {
border-top: 2px solid #eee;
border-right: 2px solid #a9a9a9;
border-bottom: 2px solid #a9a9a9;
}
Doesn't Work:
.hello-button {
border-top: 2px solid #eee;
border-right: 2px solid #a9a9a9;
border-bottom: 2px solid #a9a9a9;
border-left: 2px solid #eee;
}
Unless there's a valid (or at least spec'd) reason for this behavior, it looks like a bug to me...
This one is weird. It actually works if you don't specify border-style. IE9 will then give you a solid border, but other browsers will do all kinds of different things.
But it goes back to working if you specify border-radius (in addition to border-style).. So go on and treat yourself to some modern CSS styling :)
Of course this is not ideal if you want a perfectly square button, but you can set a low value for the radius (double check how it looks, though).
It does look like a bug. Can you define a document compatibility mode for an older version of IE?
http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx
Looks like a bug. Since I controll the server I solved it by setting a X-UA-Compatible response header to IE=EmulateIE8
http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx#Servers