CSS フレックスコンテナを設定

index.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>My Flexbox</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <div class="container">
    <div class="item-1">1</div>
    <div class="item-2">2</div>
    <div class="item-3">3</div>
  </div>
  <div class="container">
    <div class="item-1">1</div>
    <div class="item-2">2</div>
    <div class="item-3">3</div>
  </div>
</body>

</html>

style.css

@charset "utf-8";

.container {
  border: 8px solid blue;
  /* display: flex; */
  display: inline-flex;
  width: 280px;
}

.item-1 {
  width: 80px;
  height: 80px;
  background-color: pink;
}

.item-2 {
  width: 80px;
  height: 80px;
  background-color: skyblue;
}

.item-3 {
  width: 80px;
  height: 80px;
  background-color: orange;
}

投稿者: chosuke

趣味はゲームやアニメや漫画などです

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です