0

I am trying to get following output (a large slash line between two numbers):

enter image description here

Following code works on Firefox and Chrome but doesn't work on Safari. Would there be any workaround for that?

Here's the code:

HTML:

<div class="wrap">
    <div class="top">4</div>
    <div class="bottom">15</div>
</div>

CSS:

.top {
  display: block;
  float: left;
  font-size: 60px;
  font-weight: 700;
}

.bottom {
  display: block;
  float: left;
  font-size: 38px;
  font-weight: 700;
  margin-top: 70px;
  position: relative;
  width: 28px;
}

.bottom:before {
  border-left: 1px solid;
  content: "";
  height: 66px;
  position: absolute;
  right: 0;
  top: -35px;
  transform: skew(-45deg);
  transform-origin: left top 0;
  width: 0;
}

JSFiddle Demo: http://jsfiddle.net/pg4sxrc1/

sam
  • 1,027
  • 3
  • 11
  • 21
  • You can refer to this question http://stackoverflow.com/questions/29864790/why-on-safari-the-transform-translate-doesnt-work-correctly – Simon M. Oct 06 '15 at 09:24

1 Answers1

1

Certain versions of Safari still require the use of the -webkit- prefix for transform and transform-origin, try adding the following definitions to your .bottom:before CSS:

-webkit-transform: skew(-45deg);
-webkit-transform-origin: left top 0;

jsFiddle Demo

BenM
  • 52,573
  • 26
  • 113
  • 168