freeCodeCamp/curriculum/challenges/japanese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property...

2.3 KiB

id title challengeType videoUrl forumTopicId dashedName
587d78ae367417b2b2512afd flex-basis プロパティを使用してアイテムの初期サイズを設定する 0 https://scrimba.com/p/pVaDAv/c3d9nCa 301108 use-the-flex-basis-property-to-set-the-initial-size-of-an-item

--description--

flex-basis プロパティは、CSS が flex-shrink または flex-grow で調整する前のアイテムの初期サイズを指定します。

flex-basis プロパティが使用する単位は他のサイズ指定プロパティと同じです (pxem% など)。 auto 値は要素の中身に基づいてアイテムのサイズを設定します。

--instructions--

flex-basis を使用してボックスの初期サイズを設定します。 CSS プロパティ flex-basis#box-1#box-2 の両方に追加してください。 #box-110em の値、#box-220em の値を設定してください。

--hints--

#box-1 要素は flex-basis プロパティを持つ必要があります。

assert($('#box-1').css('flex-basis') != 'auto');

#box-1 要素の flex-basis プロパティを 10em に設定してください。

assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g));

#box-2 要素は flex-basis プロパティを持つ必要があります。

assert($('#box-2').css('flex-basis') != 'auto');

#box-2 要素の flex-basis プロパティを 20em に設定してください。

assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g));

--seed--

--seed-contents--

<style>
  #box-container {
    display: flex;
    height: 500px;
  }

  #box-1 {
    background-color: dodgerblue;
    height: 200px;

  }

  #box-2 {
    background-color: orangered;
    height: 200px;

  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>

--solutions--

<style>
  #box-container {
    display: flex;
    height: 500px;
  }

  #box-1 {
    background-color: dodgerblue;
    height: 200px;
    flex-basis: 10em;
  }

  #box-2 {
    background-color: orangered;
    height: 200px;
    flex-basis: 20em;
  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>