【CSS】Flexboxの使い方を徹底解説!基本から実践まで(サンプルあり)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>flexcontainer</title> <link rel="stylesheet" href="./style.css"> </head> <body> <div id="makeImg"class="flexcontainer"/> <div class="flexitem item1">Item 1</div> <div class="flexitem item2">Item 2</div> <div class="flexitem item3">Item 3</div> </body> </html>
.flexcontainer{ //display:flex; } .flexitem{ width: 100%; height: 100px; text-align: center; } .item1{ background: #faa6a6;; } .item2{ background: #8bbaff; } .item3{ background: #f3ffbe; }
.flexcontainer{ display:flex; flex-direction:row; // デフォルトrow } ...
.flexcontainer{ display:flex; flex-direction:column; }