w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to strike through obliquely with css showing the text on top of the strike through

You can give the strikethru a lower z-index than the text. I highlighted the text red so it can be seen:

.strikethrough {
  position: relative;
  color: #f00;
}
.strikethrough:before {
  position: absolute;
  z-index: -1;
  content: "";
  left: 0;
  top: 50%;
  right: 0;
  border-top: 1px solid;
  border-color: #000;

  -webkit-transform:rotate(-5deg);
  -moz-transform:rotate(-5deg);
  -ms-transform:rotate(-5deg);
  -o-transform:rotate(-5deg);
  transform:rotate(-5deg);
}

http://jsbin.com/oqibus/109/





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.