对角线div覆盖

编程入门 行业动态 更新时间:2024-10-28 02:35:01
本文介绍了对角线div覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一些选择框,我想禁用,使用disabled属性,但我想要在顶部有一个div,沿着字段对角线(如在房地产销售标志上的已售出),'disabled'。

有没有任何跨浏览器的方法来实现这个效果与css?

我不想使用图像做这个

解决方案

我可能只是为了简单而使用图片,但如果你坚持:

请参阅: jsfiddle/yPRUN/

这是用于生成跨浏览器CSS的神奇工具。 a> 如果您要进行任何更改,您将需要它。

您应该将IE CSS放在一个新的样式表中,

code>< div class =disabled> disabled< / div> <! - [if IE]> < style> .disabled { / * IE8 + - 必须在一行,不幸的是* / -ms-filter:progid:DXImageTransform.Microsoft.Matrix(M11 = 0.7071067811865473, M12 = -0.7071067811865477,M21 = 0.7071067811865477,M22 = 0.7071067811865473,SizingMethod ='auto expand'); / * IE6和7 * / filter:progid:DXImageTransform.Microsoft.Matrix( M11 = 0.7071067811865473, M12 = -0.7071067811865477, M21 = 0.7071067811865477, M22 = 0.7071067811865473, SizingMethod ='auto expand'); / * *使转换原点位于 *对象的中间。 * / 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); }

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'd probably just go with an image for simplicity, but if you insist:

See: 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 comments.

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); }

更多推荐

对角线div覆盖

本文发布于:2023-11-30 10:20:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对角线   div

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!