css - 如何将此按钮旋转 180°?

标签 css

我正在尝试旋转 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) 改用众多 Unicode 字符之一。请参阅此维基百科页面:http://en.wikipedia.org/wiki/Arrow_(symbol)

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

相关文章:

css - 对齐 2 个按钮。 1左1右

html5 : how can i trigger or stop a css3 loop animation?

html - 页脚向上 float 到列中

html - html 和 body 样式同时存在是一个问题吗?

css - 对外部 css 文件的单行注释

html - 如何删除页脚下的空间?

css - 3d变换,逆变换不对称

javascript - 一些 Javascript/CSS 动画

javascript - Tumblr Reblog 代码无法正常工作?

html - 导航栏被以下文本覆盖