css3实现边框旋转但内容不动 电脑版发表于:2020/8/12 15:30 其实思路就是把文字旋转的角度反向旋转抵消掉div旋转的角度即可 ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style> .container{ margin: 50px; width: 100px; height: 100px; text-align: center; border: 1px solid #000; transform: rotate(45deg); transform-origin:center 50%; } .txt{ display: inline-block; line-height: 100px; transform: rotate(-45deg); transform-origin:center 50%; } </style> </head> <body> <div class="container"> <span class="txt">文字</span> </div> </body> </html> ```