我试图旋转css按钮中的箭头,但是如果不旋转整个按钮就无法继续...

关键是要从上传按钮创建一个下载按钮。如何只旋转箭头?

按钮:

body {
  background: #2d3e4f;
}
.cntr {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}
.upload {
  display: block;
  width: 40px;
  height: 50px;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  background: #e64d43;
  cursor: pointer;
}
.upload:after {
  content: '';
  position: absolute;
  display: block;
  top: 0px;
  right: 0px;
  width: 0px;
  height: 0px;
  -webkit-border-radius: 0px 2px 0px 2px;
  border-radius: 0px 2px 0px 2px;
  background: -webkit-linear-gradient(45deg, #c5251a 50%, #2d3e4f 50%);
  background: -moz-linear-gradient(45deg, #c5251a 50%, #2d3e4f 50%);
  background: -o-linear-gradient(45deg, #c5251a 50%, #2d3e4f 50%);
  background: -ms-linear-gradient(45deg, #c5251a 50%, #2d3e4f 50%);
  background: linear-gradient(45deg, #c5251a 50%, #2d3e4f 50%);
  -webkit-transition: all 0.2s linear;
  -moz-transition: all 0.2s linear;
  -o-transition: all 0.2s linear;
  -ms-transition: all 0.2s linear;
  transition: all 0.2s linear;
}
.upload i {
  width: 2px;
  height: 14px;
  background: #fff;
  display: block;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  -webkit-transition: all 150ms linear;
  -moz-transition: all 150ms linear;
  -o-transition: all 150ms linear;
  -ms-transition: all 150ms linear;
  transition: all 150ms linear;
}
.upload i:before,
.upload i:after {
  content: '';
  position: absolute;
  display: block;
  width: 2px;
  height: 8px;
  background: #fff;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  -webkit-transition: all 150ms linear;
  -moz-transition: all 150ms linear;
  -o-transition: all 150ms linear;
  -ms-transition: all 150ms linear;
  transition: all 150ms linear;
}
.upload i:before {
  -webkit-transform: rotate(45deg) translateX(-3px);
  -moz-transform: rotate(45deg) translateX(-3px);
  -o-transform: rotate(45deg) translateX(-3px);
  -ms-transform: rotate(45deg) translateX(-3px);
  transform: rotate(45deg) translateX(-3px);
}
.upload i:after {
  -webkit-transform: rotate(-45deg) translateX(3px);
  -moz-transform: rotate(-45deg) translateX(3px);
  -o-transform: rotate(-45deg) translateX(3px);
  -ms-transform: rotate(-45deg) translateX(3px);
  transform: rotate(-45deg) translateX(3px);
}
.upload:hover i {
  height: 18px;
}
.upload:hover:after {
  width: 12px;
  height: 12px;
}

最佳答案

有几种更有效的方法可以做到这一点。

a)跳过所有内容,并使用工具创建原始图像旋转180度的备用按钮图像。

b)改用NUMEROUS Unicode字符之一。参见以下维基百科页面:http://en.wikipedia.org/wiki/Arrow_(symbol)

关于css - 如何将这个按钮旋转180°?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29446207/

10-12 12:50
查看更多