코드:
결과보기 »
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>CSS3 Flexible Box Layout</title> <style> .flexbox { background-color: dimgray; width: 400px; height: 250px; margin: 10px 0; border-radius: 15px; display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; } .item { background-color: darkgray; border-radius: 10px; width: 80px; height: 50px; color: white; font-size: 20px; text-align: center; line-height: 50px; margin: auto; } </style> </head> <body> <h1>margin 속성을 이용한 플렉스 요소의 가운데 정렬</h1> <div class="flexbox"> <div class="item">Center</div> </div> </body> </html>