Quantcast
Channel: CSSタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8764

【CSS】比率で配置できるFlexboxのflexプロパティ

$
0
0
はじめに 比率で配置できるFlexboxのflexプロパティについてのまとめです。 flex:数値 比率で配置する アイテムをどのような比率で配置するか html <!DOCTYPE html> <html lang="ja"> <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="style.css" /> </head> <body style="margin: 0"> <div class="container"> <div class="item item1">Item 1</div> <div class="item item2">Item 2</div> </div> </body> </html> 下記のコードの場合、1対3の比率で配置できる css .container{ display: flex; } .item1 { background-color: pink; flex: 1; } .item2 { background-color: blue; flex: 3; }

Viewing all articles
Browse latest Browse all 8764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>