Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

Transform แบบ Scale บนแกน Z (scaleZ) ด้วย CSS3


เมธอด scaleZ(z) ใช้สำหรับการ transform แบบ scale บนแกน Z

รูปแบบไวยากรณ์ (Syntax):

scaleZ(z)

ที่นี่ z เป็นตัวเลขที่แทนตัวคูณการปรับขนาด (scaling factor) สำหรับพิกัด z ของแต่ละจุดขององค์ประกอบ

ตัวอย่าง:

div {
  width: 60px;
  height: 60px;
  background-color: black;
}
.perspective {
  transform: perspective(200px) translateZ(-150px);
  background-color: yellow;
}
.scaled-translated {
  transform: perspective(200px) scaleZ(2) translateZ(-150px);
  background-color: orange;
}