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

เพิ่ม Layer ใน HTML (Deprecated)


หมายเหตุ: แท็ก <layer> เป็น proprietary tag ของ Netscape 4 ถูก deprecated และไม่รองรับในเบราว์เซอร์สมัยใหม่ ไม่ควรใช้

เดิมใช้จัดตำแหน่งและแอนิเมชันองค์ประกอบด้วย scripting คิดได้ว่าเป็นเอกสารแยกซ้อนบนหลัก

ตัวอย่างโค้ดเก่า (ไม่ทำงานในเบราว์เซอร์ปัจจุบัน)

<!DOCTYPE html> <html>    <head>       <title>HTML layer Tag</title>    </head>    <body>       <layer id="layer1" top="250" left="50" width="200" height="200" bgcolor="red">          <p>layer 1</p>       </layer>       <layer id="layer2" top="350" left="150" width="200" height="200" bgcolor="blue">          <p>layer 2</p>       </layer>       <layer id="layer3" top="450" left="250" width="200" height="200" bgcolor="green">          <p>layer 3</p>       </layer>    </body> </html>

ทางเลือกปัจจุบัน: ใช้ CSS position: absolute/relative/fixed/sticky ร่วมกับ z-index และ transform/animation สำหรับการจัดเลย์เอาต์และแอนิเมชัน