CSS3:带有阴影的立方体
我认为在这种情况下,图像胜于雄辩。
我想得到这样的效果:
但我能做到的最好CSS3 的做法是这样的:
而这个代码绝对是糟糕的:
box-shadow: 1px 1px hsl(0, 0%, 27%),
2px 2px hsl(0, 0%, 27%),
3px 3px hsl(0, 0%, 27%),
4px 4px hsl(0, 0%, 27%),
5px 5px hsl(0, 0%, 27%),
6px 6px hsl(0, 0%, 27%),
7px 7px hsl(0, 0%, 27%),
8px 8px hsl(0, 0%, 27%),
...
有没有这样我就可以用 pure 创建这样的效果CSS3?我不介意它是 3D 的,但等轴测的会更好。
我不需要将内容放置在盒子的侧面,只需放置在正面,因此我只使用一个
元素。这是我到目前为止所拥有的:http://jsfiddle.net/X7xSf/3/任何
帮助将不胜感激!
I think images speak louder than words in this case.
I want to get this effect:
But the best I can do with CSS3 is this:
And the code for this is absolutely terrible:
box-shadow: 1px 1px hsl(0, 0%, 27%),
2px 2px hsl(0, 0%, 27%),
3px 3px hsl(0, 0%, 27%),
4px 4px hsl(0, 0%, 27%),
5px 5px hsl(0, 0%, 27%),
6px 6px hsl(0, 0%, 27%),
7px 7px hsl(0, 0%, 27%),
8px 8px hsl(0, 0%, 27%),
...
Is there any way that I can create an effect like this with pure CSS3? I don't mind having it be 3D, but isometric would be preferred.
I don't need to place content onto the sides of the box, just onto the front face, so I'm working with just a single <div>
element.
Here's what I have so far: http://jsfiddle.net/X7xSf/3/
Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会在一些 CSS 生成的元素上使用一些倾斜变换...看看这个:
http://jsfiddle .net/X7xSf/12/
如果我想在生产中使用它,我可能会确定哪些浏览器支持之前和之后,但不支持转换(仅 IE8),然后使用 Paul Irish 的方法2008 (http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/) 为 IE8 关闭此功能。
I'd use some skew transforms on some CSS generated elements... Take a look at this:
http://jsfiddle.net/X7xSf/12/
If I wanted to use this in production, I'd probably identify which browsers support before and after, but not transforms (only IE8), then use Paul Irish's method from 2008 (http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/) to turn this off for IE8.
嗯...我的想法是使用边框黑客和一些屏蔽来让它在...至少 IE 8 中工作?
但我不知道如何让边框向后移动修复了它。您可以在这里看到我的想法: http://jsfiddle.net/k2AdU/1
代码概念是使用 :before 和 :after 为角创建蒙版
Well... My idea was to use border hacks and some masking to get it to work in... IE 8 at least?
But I can't figure out how to get the border to animate backwardsFixed it.You can see my idea here: http://jsfiddle.net/k2AdU/1
and the code concept is to use :before and :after to create a mask for the corners