CSS mask-positionคุณสมบัติ
ตัวอย่าง
กำหนดตำแหน่งของภาพเลเยอร์มาสก์ให้อยู่ตรงกลาง:
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
-webkit-mask-size: 50%;
mask-size: 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
}
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติmask-position
กำหนดตำแหน่งเริ่มต้นของภาพมาสก์ (สัมพันธ์กับพื้นที่ตำแหน่งมาสก์)
เคล็ดลับ:ตามค่าเริ่มต้น รูปภาพมาสก์จะอยู่ที่มุมซ้ายบนขององค์ประกอบ และทำซ้ำทั้งในแนวตั้งและแนวนอน
ค่าเริ่มต้น: | 0% 0% |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ไม่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS3 |
ไวยากรณ์ JavaScript: | วัตถุ .style.maskPosition="100px center" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Numbers ตามด้วย -webkit- ระบุเวอร์ชันแรกที่ทำงานกับคำนำหน้า
Property | |||||
---|---|---|---|---|---|
mask-position | 4.0 -webkit- | 79.0 -webkit- | 53.0 | 4.0 -webkit- | 15.0 -webkit- |
ไวยากรณ์ CSS
mask-position: value;
มูลค่าทรัพย์สิน
Value | Description |
---|---|
left top left center left bottom right top right center right bottom center top center center center bottom |
If you only specify one keyword, the other value will be "center" |
x% y% | The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. Default value is: 0% 0% |
xpos ypos | The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
กำหนดตำแหน่งของภาพเลเยอร์มาสก์ที่มุมล่างขวา:
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
-webkit-mask-size: 50%;
mask-size: 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: 100% 100%;
mask-position: 100% 100%;
}
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: คุณสมบัติ mask-image
การอ้างอิง CSS: คุณสมบัติโหมดมาสก์
การอ้างอิง CSS: คุณสมบัติที่มาที่มาสก์
การอ้างอิง CSS: คุณสมบัติ mask-repeat
การอ้างอิง CSS: คุณสมบัติขนาดมาสก์
กวดวิชา CSS: CSS Masking