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. python - 我在使用pip install -r requirements.txt下載時,為什么部分能下載,部分不能下載2. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處3. node.js - nodejs開發中常用的連接mysql的庫4. 網頁爬蟲 - python 爬取網站 并解析非json內容5. mysql - jdbc的問題6. Python爬蟲如何爬取span和span中間的內容并分別存入字典里?7. 視頻文件不能播放,怎么辦?8. mysql - 如何減少使用或者不用LEFT JOIN查詢?9. python - 編碼問題求助10. linux - python 抓取公眾號文章遇到驗證問題
