코드:
결과보기 »
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>CSS3 Flexible Box Layout</title> <style> .flexbox { background-color: dimgray; width: 500px; height: 300px; border-radius: 15px; display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; } .item { background-color: darkgray; border-radius: 10px; width: 80px; margin: 10px; color: white; font-size: 26px; text-align: center; line-height: 50px; } .item:nth-child(2) { -webkit-align-self: flex-start; align-self: flex-start; } .item:nth-child(3) { -webkit-align-self: flex-end; align-self: flex-end; } .item:nth-child(4) { -webkit-align-self: center; align-self: center; } .item:nth-child(5) { -webkit-align-self: baseline; align-self: baseline; } </style> </head> <body> <h1>align 속성을 이용한 플렉스 요소의 정렬 설정</h1> <div class="flexbox"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> <div class="item">5</div> </div> </body> </html>