css3里rotate怎么實現如圖的效果
問題描述
原始圖形如下:
想旋轉90度, 如下:
問題來了: 使用transform-origin, 使用哪個值旋轉90度都到不了這個圖形, 請問:如何實現??
總結
感謝各位, 已解決, 效果可以看下采納的答案, 我總結一下, 這個旋轉和寬度沒有關系, 只要transform-origin的兩個值都設置成為高度的50%即可
.content { width: 300px; line-height: 200px; background-color: #777777; position: absolute; top:0; left:0; transform-origin : 100px 100px; text-align: center;}
問題解答
回答1:請看案例:http://jsbin.com/qewubuz/edit...,樓上的說法是正確的
回答2:transform-origin的值設為短邊的一半(即高的一半)就可以
回答3:需要使用:transform-origin:50px 50px 0;transform-origin:高度的50% 高度的50% 0;http://runjs.cn/code/ovvcgcbg
回答4:<!DOCTYPE html><html><head><style> p{margin:30px;width:200px;height:100px;background-color:yellow;/* Rotate p */transform:rotate(90deg);-ms-transform:rotate(90deg); /* Internet Explorer */-moz-transform:rotate(90deg); /* Firefox */-webkit-transform:rotate(90deg); /* Safari 和 Chrome */-o-transform:rotate(90deg); /* Opera */}</style></head><body><p>Hello World</p></body></html>回答5:
直接transform:rotate(90deg)就行了啊
相關文章:
1. vim里的高亮javascript的javascript.vim 已經放到syntax里了,但是不行。2. mysql儲存json錯誤3. android - xml的drawable作背景,是否會產生錯誤4. 我何時應該在Java中使用JFrame.add(component)和JFrame.getContentPane()。add(component)5. javascript - ie11以下單擊打開不了file,雙擊可以。求解?6. html5 - 在Mac里使用vscode,卻無法使用已下載的擴展……7. 為啥獲取不到呀?8. 輸入地址報以下截圖錯誤,怎么辦?9. node.js - node中MYSQL的異步問題10. javascript - 求助一個關于indexedDB的問題
