如何旋转外部div而不是内部内容

时间:2018-12-27 07:04:23

标签: html5 css3 rotation css-transforms

如何在div内放置图像并将该div旋转45度?

2 个答案:

答案 0 :(得分:1)

scale的变换样式添加img值,如下所示:

.profile-photo { width: 210px; height: 210px; position: relative; left: 43px; top: 50px; border: 8px solid #000; border-radius: 60px; transform: rotate(45deg); overflow: hidden; z-index: 2; background: #34983e;padding:0 }

.profile-photo img {
  width: 100%;
  transform: rotate(-45deg) scale(1.21)
}
<div class="profile-photo"> 
  <img alt="Profile photo" src="http://www.michiganurology.com/wp-content/uploads/2015/10/reddy.jpg" onerror="this.onerror=null;this.src='https://via.placeholder.com/500/E5E8EC/4B89DA?text=error+image';">
</div>

答案 1 :(得分:0)

使用下面的代码。

HTML

for i in df.index:
    if df.at[i, 2] == 'Calm': 
        df.at[i, 2] = 1
    else:
        df.at[i, 2] = re.findall('[0-9]+', df.at[i, 2])[0]

CSS

<div class="div">
    <img src="index.png">
</div>

W3schools transforms