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

Transform ย้ายองค์ประกอบตามแกน Z ด้วย CSS3 translateZ()


ใช้เมธอด translateZ(z) เพื่อย้าย (transform) องค์ประกอบตามแกน Z

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

translateZ(z)

ที่นี่:

z: เป็นความยาวแทนองค์ประกอบ Z ของเวกเตอร์การย้าย

ตัวอย่าง:

div {
  width: 40px;
  height: 40px;
  background-color: black;
}
.trans {
  transform: perspective(400px) translateZ(100px);
  background-color: orange;
}