We are trying to have a badge over the corner of a picture. For this we use a parent <div>
as wrapper and a <span>
inside. It's working fine so far for Chrome, Firefox, and IE11 but in MS Edge it's not working as expected. It seems like Edge calculates the right:
property very different from the others.
Here is my code:
.parent {
width: 200px;
height: 200px;
border: 1px solid black;
position: relative;
overflow: hidden;
}
.child {
background-color: #e2001a;
position: absolute;
right: -65px;
width: 220px;
height: 50px;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
padding-left: 100px;
display: table;
z-index: 10;
color: white;
text-align: center;
line-height: 1.2;
}
<div class="parent">
<span class="child">Some cool text</span>
</div>
Am I doing something wrong, or is the Edge behavior very different from the other browsers?
-webkit-transform
; Firefox implements it now, IIRC. – Hike-webkit-transform
does not help – Althaaltheatransform
for many years. Did you mean to say Chrome or Edge implements it now, instead? – Spraggins-webkit-
-prefixed stuff because people kept using only those. – Hike-webkit-
prefixes for all properties (including this one, I think), but regardless, it doesn't make sense to me to suggest removing a prefixed property because a browser supports that prefix, unless you meant Firefox supports unprefixedtransform
now? in which case, Firefox supported the unprefixedtransform
long before it started supporting-webkit-
prefixes in version 49, and why single out Firefox, anyway? It supported unprefixedtransform
before Chrome, Safari, or Edge did... – Spraggins-webkit-
-only override elsewhere in the CSS or some kind of-webkit-transform
-specific behaviour. Since the code worked in Chrome and Firefox (yes, it does implement-webkit-transform
), if removing it broke the layout in those browsers, that would be the answer. Just a quick test to eliminate a few possibilities. I mentioned Firefox because it might be unexpected for a-webkit-
property to affect its behaviour, whereas it’s not unexpected for Chrome. – Hike