HTML, CSS

(51)CSS_절대 위치 지정 방식

빠스무 2023. 4. 3. 16:41
728x90
 

(35)CSS_태그 설명

font-size 텍스트 크기를 설정 px, %, em, rem font-family 텍스트의 글꼴을 설정 ✔ 글꼴을 선택하는 방법 누구나 설치되어 있는 기본 글꼴을 사용 이미지로 처리 클라리언트에 글꼴을 다운로드 시켜 사

jm-rograming.tistory.com

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>절대 위치 지정 방식</title>
    <style>
        #wrap{
            position: relative;
            width: 500px;
            height: 500px;
            border: 3px solid red;

        }
        .box{
            position: absolute;
            width: 50px;
            height: 50px;
            background-color: deeppink;  
        }
        #ab1{
            top: 0;
            right: 0;
        }
        #ab2{
            bottom: 0;
            left: 0;
        }
        #ab3{
            right: 0;
            bottom: 0;
        }
        #ab4{
            top: 100px;
            left: 150;
        }
        #ab5{
            top: 50%;
            right: 50%;
        }
    </style>
</head>
<body>
    <h2>절대 위치 지정 방식</h2>
    <div id="wrap">
        <div class="box" id="ab1"></div>
        <div class="box" id="ab2"></div>
        <div class="box" id="ab3"></div>
        <div class="box" id="ab4"></div>
        <div class="box" id="ab5"></div>
    </div>
</body>
</html>