프런트엔드-CSS

CSS 스타일링

강사: 최퍼블리셔 · 작성자: 이종춘 · 작성일: 2026-04-23 21:06:13 · 조회수: 15

스타일시트 플렉스 설명
목록으로
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

<style>

*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

.con_wrap{
width: 600px;
height: 500px;
border: 5px solid black;
display: flex;
/* =>flex적용 하고자하는 부모 엘리먼트에 넣기
=>적용하면 자식이 자동으로 왼쪽 정렬됨 */

/* justify-content: flex-start; */
/* =>기본값으로 좌우 왼쪽 정렬 */

/* justify-content: flex-end; */
/* =>좌우 오른쪽 정렬 */

/* justify-content: center; */
/* =>좌우 가운데 정렬 */

/* justify-content: space-between;
=>처음, 끝 엘리먼트를 부모 엘리먼트 끝으로 정렬하고
가운데 있는 형제 엘리먼트의 간격을 동일하게 나눠가짐 */

/* justify-content: space-around; */
/* =>형제 엘리먼트의 양옆 간격을 동일하게 나눠가짐 */

/* justify-content: space-evenly; */
/* =>형제 엘리먼트의 간격을 동일하게 나눠가짐 */

/* align-items: flex-start;
=>기본값으로 위쪽으로 정렬됨 */

/* align-items: flex-end;
=>상하 정렬 중 아래 쪽으로 정렬됨 */

/* align-items: center; */
/* =>상하 정렬 중 가운데 정렬 */

flex-direction: column;
/* =>flex축 방향을 변경 */
justify-content: space-between;

align-items: center;
}

.con{
width: 100px;
height: 100px;
background-color: gold;
border: 3px solid red;
font-size: 30px;
font-weight: 900;
}

</style>

</head>
<body>

<div class="con_wrap">
<div class="con">1</div>
<div class="con">2</div>
<div class="con">3</div>
<div class="con">4</div>
</div>

</body>
</html>
#스타일시트 플렉스

첨부 파일

0개
첨부된 파일이 없습니다.

댓글 / 답글

1개
댓글을 작성하려면 로그인하세요.
이종춘 2026-04-27 17:18
https://flexboxfroggy.com/