I want to rotate the entire table 90 degrees in the anticlockwise direction. ie. contents of td(row=ith,column=jth) should be transferred to the td(row = (total number of rows-j+1)th , column = ith). The text inside the div also should be rotated by 90degrees.
<table><tbody>
<tr><td>a</td><td>1</td><td>8</td></tr>
<tr><td>b</td><td>2</td><td>9</td></tr>
<tr><td>c</td><td>3</td><td>10</td></tr>
<tr><td>d</td><td>4</td><td>11</td></tr>
<tr><td>e</td><td>5</td><td>12</td></tr>
<tr><td>f</td><td>6</td><td>13</td></tr>
<tr><td>g</td><td>7</td><td>14</td></tr>
</tbody></table>
this table should be transformed to
<table><tbody>
<tr>
<td>8</td><td>9</td><td>10</td><td>11</td>
<td>12</td><td>13</td><td>14</td>
</tr>
<tr>
<td>1</td><td>2</td><td>3</td><td>4</td>
<td>5</td><td>6</td><td>7</td>
</tr>
<tr>
<td>a</td><td>b</td><td>c</td><td>d</td>
<td>e</td><td>f</td><td>g</td>
</tr>
</tbody></table>
I can do this by javascript loops. But its very long. I want to know whether there is a more elegant way. Thanks in advance.
90 Degree Rotation When rotating a point 90 degrees counterclockwise about the origin our point A(x,y) becomes A'(-y,x). In other words, switch x and y and make y negative.
The first trick is to use writing-mode: vertical-lr to get the text to run vertically. By itself, the text runs top to bottom, but we want it to run bottom to top, so we spin it around it with the transform: rotate(180deg) .
Syntax: transform: rotate(90deg);
The text inside the div also should be rotated by 90degrees.
So basically you just want the whole thing to be rotated as a block?
Maybe you should just use CSS?
#myTable {
transform:rotate(270deg);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With