Computer >> Computer tutorials >  >> Programming >> HTML

How to add a layer in HTML?


Use the <layer> tag in HTML to add a layer. The HTML <layer> tag is used to position and animate (through scripting) elements in a page. A layer can be thought of as a separate document that resides on top of the main one, all-existing within one window.

Example

You can try to run the following code to add a layer in HTML −

<!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>