【问题标题】:can't get the box to rotate in media query无法让框在媒体查询中旋转
【发布时间】:2021-10-03 17:57:53
【问题描述】:

我只是在 codeply 上尝试这个练习。在视口减小到小于 1000px 的宽度后,我试图让这个框旋转到 0。出于某种原因,所有其他更改似乎都有效,但轮换无效。关于为什么的任何想法?

感谢您的帮助。

这是我的代码:

.red {
background-color:red;
width:100px;
height:100px;
transform: rotate(25deg);
}

@media screen and (max-width: 1000px){
h1 {
    color: red;
    font-size:60px;
}

.red {
  transform: rotate (0);
  background-color:green;
  position: relative;
  left:300px;
}
}

【问题讨论】:

  • 可以添加HTML部分吗?

标签: css media-queries


【解决方案1】:

您的 css 中有错字。

你的 CSS:

.red {
  transform: rotate (0);
  background-color:green;
  position: relative;
  left:300px;
}

rotate(0) 之间有一个空格

正确的css:

.red {
  transform: rotate(0);
  background-color:green;
  position: relative;
  left:300px;
}

【讨论】:

  • 成功了!谢谢!!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-26
  • 2021-09-22
  • 1970-01-01
  • 1970-01-01
  • 2021-05-20
  • 2023-03-27
相关资源
最近更新 更多