Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

line-through / strike-through styling

I'm working on a website where there is a services page with a few items priced accordingly.

price

As the site is a responsive layout and the text changes depending on the device it is being viewed on...I'm looking for a way to create the above example in HTML, CSS, JavaScript or something similar without resorting to using an image such as a jpg, png etc.

I'm finding it difficult to create this as there is a line-through on the angle like so, it's a different color and controlling its thickness/weight..The best I can get is a thin line with its parent color, any suggestions?

like image 566
user1752759 Avatar asked Feb 19 '26 21:02

user1752759


1 Answers

It's possible with css3 transforms, of course no IE support, but you can use a png as fallback for old browsers:

Demo: http://jsbin.com/ejoguw/1/edit

span { position: relative; }
span:after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -3px; /* height/2 */
    width: 100%;
    height: 7px; /* Adjust */
    background: red;
    -webkit-transform: rotateZ(-10deg);
    -moz-transform: rotateZ(-10deg);
}
like image 84
elclanrs Avatar answered Feb 21 '26 11:02

elclanrs