웹(클라이언트)/CSS

static, relative position 구분

여동동 2021. 9. 27. 16:27

소스코드

<!DOCTYPE html>
<html>
  <head>
    <style>
        html{border:1px solid gray;}
        div{
            border:5px solid tomato;
            margin:10px;
        }
        #me{
            position: relative; /*static = 정적으로, relative = 상대적으로*/
            left:60px;
            top:100px;
        }
    </style>
  </head>
  <body>
    <div id="other">other</div>
    <div id="parent">
       parent
       <div id="me">me</div>
    </div>
  </body>
</html>