gtilflm gtilflm - 8 months ago 64
CSS Question

Diagonal line through <div> or <span>

I'm wanting to have a diagonal line drawn from the upper-right corner of a

to the lower-left corner. The problem is that the content will sometimes be longer or shorter. So, something like a static image won't work. Basically I want what's described here (How to create a diagonal line within a table cell?) but for a
or a

This has some interesting ideas:

So does this:

This is kind of a retry at this post: How to strike through obliquely with css

I can't seem to figure any of this out though. It seems like a pure CSS solution should work here, but I just don't have the skills to make that happen. jQuery is an option for me as well.


is first fiddle as exemple with image in background instead not good enough ?

.line {
    border: 1px solid #ccc;
    margin: 10px;
    padding: 10px;
    background-size:100% 100%;