Safari treats border-color:transparent
as overriding border-image
, whereas the opposite is true in Chrome and Firefox. (Safari is consistent with the others if border-color
is an opaque or semitransparent color. rgba(0,0,0,0)
behaves the same as transparent
. I don't know what IE does.) Concretely, this snippet:
#wrapper { background-color: red; }
#test {
border-width: 10px;
border-style: solid;
border-color: transparent;
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJAQMAAADaX5RTAAAABlBMVEUA//////+xuF6gAAAACklEQVQIHWPADQAAGwABJwptqgAAAABJRU5ErkJggg==");
border-image-slice: 1 1 1 1;
background: white;
background-clip: content-box;
}
<div id="wrapper">
<div id="test">The border of this box is blue in Chrome and Firefox,
red in Safari.</div>
</div>
draws a light blue border around the div
in Chrome and Firefox, but a red border in Safari.
Questions:
- Which behavior is correct?
- Is there any way to force Safari to behave like Chrome and Firefox?
Note: I've only tested the above example with Safari 10.0 (11602.1.50.0.10), Firefox 48.0.2, and Chrome 53.0.2785.116 (all on OSX 10.11) but the website it's cut down from has exhibited the same behavior consistently for at least a year, so I do not believe this is particularly version-specific.
Note 2: border-color:transparent
is present for the sake of browsers that don't support border-image
. (For instance, I do still care about IE 7 through 10 for the real website this is cut down from.) Proposed solutions should show the background of the wrapper, not a visible border, in browsers that don't support border-image
.