.arrow中的转换值在这里似乎没有任何作用。有人可以解释我为什么

<!doctype html>
<html>
<head>
<style>
.container{
    height:500px;
    width:600px;
}
.header{ height:40px; }
.step{width:194px;float:left; border:1px solid black; height:40px;}

.arrow{display:inline-block;width:25px; height:25px; border-left:1px solid
 black; border-bottom: 1px solid black;-webkit-transform:translateY(20px);
 transform:rotate(-135deg);  }

</style>
</head>
<body>
<div class='container'>
    <div class='header'>
      <div class='step'> step 1 <div class='arrow'> </div></div>
      <div class='step'> step 2 <div class='arrow'> </div></div>
      <div class='step'> step 3 <div class='arrow'> </div></div>
    <div class='body'> </div>
</div>

最佳答案

您应该将两个值都添加到同一个transform属性(例如transform: translateY(20px) rotate(-135deg))中,否则,由于CSS级联规则,将仅考虑最后一个:



.container {
  height: 500px;
  width: 600px;
}

.header {
  height: 40px;
}

.step {
  width: 194px;
  float: left;
  border: 1px solid;
  height: 40px;
}

.arrow {
  display: inline-block;
  width: 25px;
  height: 25px;
  border-left: 1px solid;
  border-bottom: 1px solid;
  transform: translateY(20px) rotate(-135deg);
}

<div class='container'>
  <div class='header'>
    <div class='step'> step 1 <div class='arrow'> </div></div>
    <div class='step'> step 2 <div class='arrow'> </div></div>
    <div class='step'> step 3 <div class='arrow'> </div></div>
  <div class='body'></div>
</div>

10-02 15:23