[Js Master Road Part 1] Hundreds of JavaScript examples [new version] _10 JavaScript outputs a diagonal div

 

[Js Master Road Part 1] Hundreds of JavaScript examples [new version] _10 JavaScript outputs a diagonal div

 

 

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Document</title>
 6     <style>
 7        div {
 8            width: 50px;
 9            height: 50px;
10            background: palevioletred;
11            position: absolute;
12            line-height: 50px;
13            text-align: center;
14            color:white;
15            font-size: 40px;
16        }
17     </style>
18     <script>
19         for( var i = 0; i < 10; i++ ){
20            document.write("<div style='left:"+(i*50)+"px;top:"+(i*50)+"px;'>"+(i+1)+"</div>");
21         }
22     </script>
23 </head>
24 <body>
25 
26 </body>
27 </html>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325369154&siteId=291194637