javascript - Diagonal div overlay - Stack Overflow

I'm trying to get a diagonal div across some content.I have some select boxes that I would like to

I'm trying to get a diagonal div across some content.

I have some select boxes that I would like to disable, using the disabled property, but I would like to have a div on top with the word 'disabled' going along the fieldset diagonally (like 'sold' on real estate for sale signs).

Is there any cross browser way to achieve this effect with css?

I don't want to use an image to do this

I'm trying to get a diagonal div across some content.

I have some select boxes that I would like to disable, using the disabled property, but I would like to have a div on top with the word 'disabled' going along the fieldset diagonally (like 'sold' on real estate for sale signs).

Is there any cross browser way to achieve this effect with css?

I don't want to use an image to do this

Share Improve this question edited May 9, 2011 at 1:13 qwertymk asked May 9, 2011 at 1:06 qwertymkqwertymk 35.4k30 gold badges124 silver badges184 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

I'd probably just go with an image for simplicity, but if you insist:

See: http://jsfiddle/yPRUN/

This is the magical tool used to generate the cross-browser CSS.
You'll need it if you want to make any changes.

You should of course put the IE CSS inside a new stylesheet and include it inside the conditional ments.

HTML:

<div class="disabled">disabled</div>

<!--[if IE]>
<style>
.disabled {   

    /* IE8+ - must be on one line, unfortunately */    
    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865473, M12=-0.7071067811865477, M21=0.7071067811865477, M22=0.7071067811865473, SizingMethod='auto expand')";      

    /* IE6 and 7 */    
    filter: progid:DXImageTransform.Microsoft.Matrix(
        M11=0.7071067811865473,            
        M12=-0.7071067811865477,
        M21=0.7071067811865477,            
        M22=0.7071067811865473,            
        SizingMethod='auto expand');   

    /*    
    * To make the transform-origin be the middle of    
    * the object.      
    */   
    margin-left: 2px;    
    margin-top: -34px;
}
</style>
<![endif]-->

CSS:

.disabled {
    background: red;
    width: 100px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    color: #fff;
    font-weight: bold
}

.disabled {     
    width:             100px;     
    height:            30px;     
    -moz-transform:    rotate(45deg);     
    -o-transform:      rotate(45deg);     
    -webkit-transform: rotate(45deg);     
    transform:         rotate(45deg);
}

Yes... use an image with position: absolute positioned before the fieldset. That's probably about as cross-browser as you can do in that situation.

If you are cool with jQuery, check out element blocking with BlockUI.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744905193a4600213.html

相关推荐

  • javascript - Diagonal div overlay - Stack Overflow

    I'm trying to get a diagonal div across some content.I have some select boxes that I would like to

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信