CSS Background-color overlapses with border on table cell in IE
Asked Answered
P

2

8

I have a table with two simple table cells:

<table>
  <tr>
    <td>Test1</td>
  </tr>
  <tr>
    <td>Test2</td>
  </tr>
</table>

And I add the following CSS to the table cells:

td {
  border: 1px solid #000;
  background-color: #CCC;
}

For some reason when I view this in IE it shows the background on TOP of the border, if I uncheck the background in DOM explorer I can see the border is there.

I guess this has something to do with a parent element, but there are soooo many parent elements I can't paste all that code here.

Anyone has an idea what this might be?

Psychologize answered 24/6, 2015 at 15:21 Comment(2)
Unfortunately we can't reproduce this unless you give us more code. "Why isn't my code working" questions require at least enough code to reproduce the problem.Kevel
Without code its a bit hard to help, what happens when you add border-style: inset; to your table css?Oboe
F
16

if you do not want to change the positioning, try

background-clip: padding-box;
Ferule answered 22/9, 2016 at 12:59 Comment(0)
P
8

As I expected, it was due to a position rule in CSS:

td {
    position: relative
}

No idea why this is, but removing that solved it.

Took me forever to narrow down tho, which is why i started this post in the first place, to save me time. but alright fixed now :)

Psychologize answered 25/6, 2015 at 4:55 Comment(1)
Excellent. solved my issueEquidistant

© 2022 - 2024 — McMap. All rights reserved.