📜  悬停时按钮倾斜滑动 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:37.803000             🧑  作者: Mango

代码示例1
div {
  position: relative;
  display: inline-block;
  padding: 15px 70px;
  border: 5px solid #B17461;
  color: #B17461;
  font-size: 30px;
  font-family: arial;
  transition: color .5s;
  overflow:hidden;
}
div:before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 130%; height: 100%;
  background: #B17461;
  z-index: -1;
  transform-origin:0 0 ;
  transform:translateX(-100%) skewX(-45deg);
  transition: transform .5s;
}
div:hover {
  color: #fff;
}
div:hover:before {
  transform: translateX(0) skewX(-45deg);
}