Rabu, 27 Agustus 2025

HTML - Div Position

 


<html>
<head>
<title>Sticky Positioning With No Script</title>
<style>
   BODY {font-family: arial; font-size: 18pt; font-weight: bold;}
   DIV { width: 80px; height: 80px; text-align: center;
         position: absolute;  }
</style>
</head>
<body>
<div id=Blue style="left:
expression(document.body.clientLeft + 10);
                    top: expression(document.body.clientTop + 10);
                    background: blue;">
Top Left</div>
<div id=Red style="left: expression(document.body.clientLeft
+ 10);
                   top: expression(document.body.clientHeight -
                                 document.body.style.border - 90);
                   background: red;">
Bottom Left</div>
<div id=Green style="left:
expression(document.body.clientWidth - 90);
                     top: expression(document.body.clientTop + 10);
                     background: green;">
Top Right</div>
<div id=Yellow style="left:
expression(document.body.clientWidth - 90);
                      top: expression(document.body.clientHeight -
                                    document.body.style.border -
90);
                      background: yellow;">
Bottom Right</div>
<div id=Purple style="left:
expression((document.body.clientWidth -
                                      80)/2);
                      top: expression((document.body.clientHeight -
                                     80)/2);
                      background: purple;">
Center</div>
</body>
</html>


Tidak ada komentar: