简体   繁体   English

CSS转换元素的建议

[英]CSS transform elements suggestion

Stackoverflow not allowed to post image due to I need 10 rep to post image tha'ts why I posted link Stackoverflow不允许发布图片,因为我需要10次回复才能发布图片,这是我为什么发布链接的原因

I sketched my idea and I want to create similar to this. 我概述了我的想法,我想创建类似于此。 http://themesand.com/link.jpg http://themesand.com/link.jpg

Could you give me suggestion. 你能给我建议吗。 I try to create it with css such as writing code similar to this. 我尝试用css创建它,比如编写类似于此的代码。

first creating div class='main' and adding div class='box' inside main and writing css rotating box elements 首先创建div class='main'并在main div class='box'添加div class='box'并编写css旋转box元素

or there have any other js plugins to achieve similar effect? 或者还有其他js插件来实现类似的效果?

What could you suggest me? 你有什么建议我的?

transform: rotate(45deg); 变换:旋转(45度); will do the trick 会做的

.box {
  border:1px dashed black;
  width:100px;
  height:100px;
  position:relative;
  -webkit-transform:rotate(45deg);
  overflow:hidden;
}

I have made a pen with a rough solution: http://codepen.io/anon/pen/kwifj 我用粗略的解决方案制作了一支笔: http : //codepen.io/anon/pen/kwifj

If you wish to have some content in those boxes, you have to rotate it back. 如果您希望在这些框中包含某些内容,则必须将其旋转回来。 Another solution would be some absolute positioning and rendering text over the rotated elements. 另一个解决方案是在旋转后的元素上进行绝对定位和渲染文本。

You can do it using CSS transform property 您可以使用CSS转换属性来完成

div.box{
    -ms-transform: rotate(30deg); /* IE 9 */
    -webkit-transform: rotate(30deg); /* Chrome, Safari, Opera */
    transform: rotate(30deg); /* Standard syntax */
}

adjust the rotate degrees to match with your image and use number of div's with number of boxes. 调整旋转度数以匹配您的图像,并使用div的数量与框的数量。

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

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