【问题标题】:How to rotate a single image in HTML?如何在 HTML 中旋转单个图像?
【发布时间】:2017-11-06 01:48:57
【问题描述】:

我想在我创建的表格中旋转 3 张图像。我已将图像添加到这篇文章中。我很难学习如何做到这一点,我在上面找不到任何东西。我希望它不断旋转。自转应该像行星绕轴自转一样。 BARCELONA

<table>
    <tr>
        <th colspan="2"><h3>Favorite Teams</h3></th>
    </tr>
    <tr>
        <th>Team</th>
        <th>What sport?</th>
        <th>Logo</th>
    </tr>
    <tr>
        <th>Pittsburgh Steelers</th>
        <th>American Football</th>
        <th><img src="steelers.jpg" height="100"></th>
    </tr>
    <tr>
        <th>Michigan Wolverines</th>
        <th>American Football</th>
        <th><img src="wolverines.jpg" height="100"></th>
    </tr>
    <tr>
        <th>FC Barcelona</th>
        <th>Football</th>
        <th><img src="barcelona.jpg" height="100"></th>
    </tr>
</table>

【问题讨论】:

标签: html css transform


【解决方案1】:

这将旋转图像。

如果您想为旋转设置动画 - 请参阅此答案:CSS3 Rotate Animation

.rotate {
  -webkit-transform: rotate(20deg);
  transform: rotate(20deg);
}
    <table>
        <tr>
            <th colspan="2"><h3>Favorite Teams</h3></th>
        </tr>
        <tr>
            <th>Team</th>
            <th>What sport?</th>
            <th>Logo</th>
        </tr>
        <tr>
            <th>Pittsburgh Steelers</th>
            <th>American Football</th>
            <th><img class="rotate" src="steelers.jpg" height="100"></th>
        </tr>
        <tr>
            <th>Michigan Wolverines</th>
            <th>American Football</th>
            <th><img class="rotate" src="wolverines.jpg" height="100"></th>
        </tr>
        <tr>
            <th>FC Barcelona</th>
            <th>Football</th>
            <th><img class="rotate" src="barcelona.jpg" height="100"></th>
        </tr>
    </table>

【讨论】:

  • 但不要太快 OP 说。添加一个过渡会更好。
猜你喜欢
  • 2018-10-22
  • 2013-11-04
  • 2011-01-16
  • 1970-01-01
  • 2013-12-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多