본문 바로가기
Web/Css

css 활용4 배치

by 개발에정착하고싶다 2022. 9. 6.
320x100

지금부터 css 등, 익숙하지 않은것에 대해서 메모는 최대한 생략하고

완전히 이해 될때까지 반복 또 반복하면서, 이해가 잘 되기 시작했을때 부터 메모를 하고자 한다.

 

# 배치

 

#html 영역

 

<!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>Document</title>
    <link rel="stylesheet" href="./main.css">
</head>
<body>
    <div class="container">
        <div class="item">Apple</div>
        <div class="item">Banana</div>
    </div>
</body>
</html>

# css 영역

 

.container {
    width: 400px;
    height: 250px;
    margin: 50px;
    padding: 20px;
    background-color: orange;
    box-sizing: border-box;
    position: relative;
}
.container .item {
    width: 100px;
    height: 100px;
    background-color: royalblue;    
}

.container .item:nth-child(1) {
    position: absolute;
    left: 40px;
    bottom: 100px;
}

.container .item:nth-child(2) {
    position: absolute;
    top: 20px;
    right: 100px;
}
300x250

'Web > Css' 카테고리의 다른 글

css 활용6 전환, 변환  (0) 2022.09.06
css 활용5 플렉스(정렬)  (0) 2022.09.06
css 활용3 배경  (0) 2022.09.05
css 활용2 글꼴, 문자  (0) 2022.09.05
css 활용1 박스 모델  (0) 2022.09.05