简体   繁体   English

圆角和阴影应用于一个div?

[英]Rounded corners AND shadow applied to one div?

How? 怎么样? Any suggestions besides CSS? 除了CSS还有什么建议吗?

I have tried JQuery (dropCurves, shadow, shadedborder, corner osv). 我尝试了JQuery(dropCurves,shadow,shaddborder,corner osv)。

The general array of options: 常规选项:

  1. Use background images with both the rounding and shadow applied and a series of divs to create the rounded corners. 使用同时应用了圆角和阴影以及一系列div的背景图像来创建圆角。
  2. Use CSS3 border-radius and box-shadow. 使用CSS3 border-radius和box-shadow。 (reliable in FF3.5+, Safari 4+, and Chrome 2+. No IE support.) (在FF3.5 +,Safari 4+和Chrome 2+中可靠。不支持IE。)
  3. Use javascript to create a series of incrementally smaller divs (faux rounding accomplished by stair-steps) and then add rounding. 使用javascript创建一系列逐渐减小的div(通过阶梯完成仿制舍入),然后添加舍入。

In order of difficulty to you, CSS3, normal CSS with background images, Javascript techniques. 为了给您带来困难,请使用CSS3,带有背景图片的常规CSS,JavaScript技术。

Most of the javascript corner rounding techniques out there are just shortcuts to #1 (applying background images with CSS). 大部分的javascript圆角技巧只是#1的快捷方式(将背景图片与CSS结合使用)。 Hence using one that adds rounding and a second one that adds shadow doesn't work. 因此,使用添加了舍入的一个和添加阴影的第二个不起作用。 They end up conflicting and whichever runs last is usually the only one applied. 它们最终会发生冲突,并且最后运行的那个通常是唯一应用的一个。

The problem many solutions have by doing this on a single div is that the two plugins will often break one another. 通过在单个div上执行此操作,许多解决方案存在的问题是这两个插件经常会相互破坏。 For instance, a div that has had rounded corners applied with images won't be able to be automatically drop shadowed, because the actual border of the div extends past the rounded corners. 例如,已将圆角应用了图像的div将无法自动阴影化,因为div的实际边界超出了圆角。 The only options that I have seen reliably work are full CSS3 and a single background image with the dropshadow and the rounded corners built in. 我看到的唯一可靠的选项是完整的CSS3和带有阴影和内置圆角的单个背景图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM