用css旋转div

时间:2016-05-20 21:56:36

标签: html css

您好我想知道如何将div从上下旋转到45 dg左右,因此内容从左到右。并将内容div和45dg旋转到右边,所以它看起来像这样:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    HELLO                HOW ARE YOU?

                 HI!                      GOOD AND U?

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

单词旋转到右边,div旋转到左边

DONE:

<!DOCTYPE html>
<html>
<head>
<style>
body{



}


#myDiv {
width: 200px;
    height: 400px;

    border: 1px solid black;
margin-left: 100px;
    -ms-transform: rotate(270deg); /* IE 9 */
    -webkit-transform: rotate(270deg); /* Safari */
    transform: rotate(270deg); /* Standard syntax */
}
#sasa{
    margin-left: 100px;
margin-top: 100px;
    border: 1px solid;
    -ms-transform: rotate(90deg); /* IE 9 */
    -webkit-transform: rotate(90deg); /* Safari */
    transform: rotate(90deg); /* Standard syntax */
}
</style>
</head>
<body>



<div id="myDiv">
<div id="sasa">Hello</div><div id="sasa">Hello</div>
</div>

</body>
</html>

1 个答案:

答案 0 :(得分:1)

您可以使用轮播transform

<div class="rotated">Hello World</div>

的CSS:

.rotated {
      -webkit-transform: rotate(45deg);
          -ms-transform: rotate(45deg);
              transform: rotate(45deg);
}